I’ve gone through versions since AMP 1.x, now well into it’s new spicy name FreePBX 2.1.1 and fundamental functions are still broken. I find this shocking, since I bet every person setting it up tweaks the code themselves to get it to work, yet its not getting incorporated into the code (were is open-source failing?). Bug posted.
Set up FreePBX using the devices/users model, which allows a user to be logged into multiple extensions at once and therefore must allow for a single extension to automatically dial each device (for example, my desk phone as well as my laptop soft-phone used when out of the office). The inherent flaw I’m referring to has been bothering me since AMP times and it involves a problem when appending these extensions to the $dialstring. As usual:
Oct 11 17:29:02 VERBOSE[10681] logger.c: -- AGI Script dialparties.agi completed, returning 0
Oct 11 17:29:02 VERBOSE[10681] logger.c: -- Executing Dial("SIP/XXXXXXXXXX-b7100470", "&SIP/200&IAX2/203|20|trw") in new stack
Oct 11 17:29:02 WARNING[10681] app_dial.c: Dial argument takes format (technology/[device:]number1)
Oct 11 17:29:02 DEBUG[10681] app_dial.c: Exiting with DIALSTATUS=.
Depending on some other variables, either the call gets dropped (hung up) immediatley after entering the extension, or it says the extension is busy. The key part being:
"&SIP/200&IAX2/203|20|trw"
There should be &’s in between extensions and not at the beginning or end, since recently a line has appeared in the code solving the latter:
refer to dialparties.agi:298 // chop $ds if length($ds); - removes trailing "&" $ds = chop($ds," &");
The problem still remains in the leading &. My remedy (I’m sure there are plenty of other ways):
Replace the following (located at dialparties.agi, line 367)
foreach ($device_array as $adevice)
{
$dds = $agi->database_get('DEVICE',$adevice.'/dial');
$dialstring .= $dds['data'];
$dialstring .= '&';
}
With the following:
// try to chop leading &
$j=0;
foreach ($device_array as $adevice)
{
$dds = $agi->database_get('DEVICE',$adevice.'/dial');
$dialstring .= $dds['data'];
if ($j>0) $dialstring .= '&';
$j++;
}
Check asterisk/full for the proper extension when dialed (and your phone(s) should ring too!)
Oct 11 17:42:01 VERBOSE[10741] logger.c: -- Executing Dial("SIP/XXXXXXXXXX-b7100470", "SIP/200&IAX2/203|20|trw") in new stack
I’ve had to make this tweak or similar every time I update FreePBX (seeing as dialparties.agi gets replaced with their ‘newer’ version).