Ted Tiberio
2011-Feb-09 03:40 UTC
[asterisk-users] Manual Call Transfer (Perl, Asterisk::AGI, MySQL)
Hello Everyone! I've hit a bit of a roadblock and I am hoping that someone might point me in the right direction. I am using Asterisk 1.2.4 - I do not have the option of updating it, please do not waste your time telling me to =) I am using PERL AGI scripts to maintain an "active calls count" field for each phone in a mysql database table, for example (not actual code, just trying to illustrate) $SIG{HUP} = 'IGNORE'; .... mysql_update_call_count($user_id, ($count +1) ); $dialret = $agi->exec('Dial', $dialstring); mysql_update_call_count($user_id, ($count -1 )); (ignore the count this, did that for clarity) This works great, except when doing assisted transfers (or any transfer for that matter). We have Polycom IP550 Phones which can do the transfer with a button, As an example of this process and the problem, and assuming these are all internal phones dialing extensions... phone A dials phone B phone B presses transfer to transfer phone A to phone C phone B hangs up Because the Dial command in the AGI script executed when phone A called phone B is still running the active call count remains at 1 for phone B until the call between A and C ends (at which point they all zero out). I also tried using atxfer to resolve this problem and got a different behavior phone A dials phone B phone B presses *2 then phone C's extension to transfer phone A to phone C phone B hangs up an active call count remains at 1 for B and C but A drops to 0 count. Might be worth mentioning the possibility that phone B is already on the line when the call from phone A comes in. I thought one possible solution might be creating an [applicationmap] that essentially handles the assisted transfer manually. I've done a great deal of reading on this matter and aside from the fact that I'm still a bit fogy as to how i would even do that,.. it seems that there is still no way for me to determine who is being transferred when the second channel is opened (new uniqueid / agi script execution). Is there perhaps something I am missing which would help resolve this? I hope that I've explained my problem clearly. I have only been tinkering with asterisk for about a week so I apologize if I'm not using the appropriate vernacular. Thank you! -Ted