POSSA / freepbx-trunk-balancing

Restrict outbound calls or balance calls over multiple trunks based on user specified parameters
http://pbxossa.org/files/trunkbalance/
37 stars 30 forks source link

Patch to work with chan_dongle #26

Open dandantheitman opened 9 years ago

dandantheitman commented 9 years ago

I've been trying to use this package with chan_dongle and had to make some changes. They are below if you want to consider including them in the next release. Changes are to trunkbalance.php, added lines are 365 to 378 below.

342                 switch ($destrunk_tech)
343                 {
344                         case 'sip':
345                                 if ($count_inbound) {
346                                         $channel_filter="(dstchannel LIKE 'SIP/".$destrunk_channelid."%' OR channel LIKE 'SIP/".$destrunk_channelid."%')";
347                                 } else {
348                                         $channel_filter="dstchannel LIKE 'SIP/".$destrunk_channelid."%'";
349                                 }
350                         break;
351                         case 'iax':
352                                 if ($count_inbound) {
353                                         $channel_filter="(dstchannel LIKE 'IAX2/".$destrunk_channelid."%' OR channel LIKE 'IAX2/".$destrunk_channelid."%')";
354                                 } else {
355                                         $channel_filter="dstchannel LIKE 'IAX2/".$destrunk_channelid."%'";
356                                 }
357                         break;
358                         case 'dahdi':
359                                 if ($count_inbound) {
360                                         $channel_filter="(dstchannel LIKE 'DAHDI/".$destrunk_channelid."%' OR channel LIKE 'DAHDI/".$destrunk_channelid."%')";
361                                 } else {
362                                         $channel_filter="dstchannel LIKE 'DAHDI/".$destrunk_channelid."%'";
363                                 }
364                         break;
365                         case 'custom':
366                                 if (strcmp(substr($destrunk_channelid,0,6),"dongle") == 0){
367                                         $dongleid=explode("/",$destrunk_channelid);
368                                         $dongleid=$dongleid[1];
369                                         if ($count_inbound) {
370                                                 $channel_filter="(dstchannel LIKE 'Dongle/".$dongleid."%' OR channel LIKE 'Dongle/".$dongleid."%')";
371                                         } else {
372                                                 $channel_filter="dstchannel LIKE 'Dongle/".$dongleid."%'";
373                                         }
374                                 }
375                                 else{
376                                         $channel_filter=$destrunk_channelid;
377                                 }
378                         break;
379                         default: $channel_filter=$destrunk_channelid;;
380                 }