Thursday, August 25, 2005

Local channel resolution delay fix

Recently I was testing an experimental version of the Sangoma Quad T1 card drivers and I ran into a delay in the Local/ channel name resolution that several SIP trunk users had described to me in the past few weeks that I had been unable to duplicate until now.

It seems that under certain circumstances a call placed through a Local/ channel, like VICIDIAL does for auto-dial calls, the channel can have it's Answer signal register before the Masquerading of the channel is complete resulting in the connected live line appearing to be a Local/ channel instead of the proper SIP, IAX or Zap channel that it actually is.

The easy workaround for this in all cases is just to give the channel more time to resolve. I found that simply putting another priority step entry for the agi transfer script in the exten of the extentions.conf file the Local channel was able to resolve itself in the few milliseconds between priority 2 and 3. Then I threw in another step just to pick up the very few that had not resolved by the 3rd priority and added a 1 second sleep to those and I now had better than 99.9% resolution of Local channel calls placed through VICIDIAL.

Here's what you have to change in your extensions.conf file:

BEFORE:
; VICIDIAL_auto_dialer transfer scripts:
exten => 8365,1,AGI(call_log.agi,${EXTEN})
exten => 8365,2,AGI(agi-VDADtransfer.agi,${EXTEN})
exten => 8365,3,Hangup
exten => 8366,1,AGI(call_log.agi,${EXTEN})
exten => 8366,2,AGI(agi-VDADtransferSURVEY.agi,${EXTEN})
exten => 8366,3,Hangup

AFTER:
; VICIDIAL_auto_dialer transfer scripts:
exten => 8365,1,AGI(call_log.agi,${EXTEN})
exten => 8365,2,AGI(agi-VDADtransfer.agi,${EXTEN})
exten => 8365,3,AGI(agi-VDADtransfer.agi,${EXTEN})
exten => 8365,4,AGI(agi-VDADtransfer.agi,${EXTEN})
exten => 8365,5,Hangup
exten => 8366,1,AGI(call_log.agi,${EXTEN})
exten => 8366,2,AGI(agi-VDADtransferSURVEY.agi,${EXTEN})
exten => 8366,3,AGI(agi-VDADtransferSURVEY.agi,${EXTEN})
exten => 8366,4,AGI(agi-VDADtransferSURVEY.agi,${EXTEN})
exten => 8366,5,Hangup


And you can download the altered AGI scripts from the project site:
http://astguiclient.sourceforge.net/experimental_code/agi-VDADtransfer.agi
http://astguiclient.sourceforge.net/experimental_code/agi-VDADtransferSURVEY.agi

and put them in your /var/lib/asterisk/agi-bin directory.

Then you must do 'extensions reload' from Asterisk CLI or just restart.


Let me know if you have any success or failure with this fix.