[Asterisk-Users] AGI solution to Grandstream BT102 call waiting problem
Walker Haddock
whaddock at datacrest.com
Mon Oct 13 20:14:50 MST 2003
I'm trying to fix a problem with the GrandStream Budgetone 102. I've been reading the source code, mailing lists and other resources. Here's the scenario and the approach I have been pursuing. I'm having some problems with the AGI calls and I hope someone can give me some clarification.
PSTN <---> T1,PRI * <---> Grandstream BT 102 (12)
<---> TDM400 (1) Fax machine
End user requires that an inbound call ring 4 of the BT 102 phones so that any available employee may answer. Generally, this works very well and the only problem I have is when another call comes in. In this case the Grandstream BT 102 rings very loudly in the ear piece and obliterates the conversation. The external party notices that the audio is cut off while the BT 102 is ringing.
The solution I am trying to develop to work around the problem is to use an AGI script to check each of the extensions in the group of phones that are supposed to be rung. I want to remove extensions that are presently in a call and not ring them with the new call. Also, I want to perform this test every 10 seconds so that I may include any extension back into the group of phones to ring if their previous call has ended.
I plan to implement a variable and increment it in a loop using gotoif to provide three or four 10 second trials for the dial. If no one answers, I'll send it to voice mail.
I have tried using ChanIsAvail and Channel status to see if I can detect when the Sip phone is busy. In the case of the ChanIsAvail, it doesn't matter if the phone is busy or not, it will still return the channel as available. Maybe the definition of channel is available does not have anything to do if it is in a call or not. In the case of the Channel Status, it always returns 201 on the Sip channel. Actually, I'm using the Asterisk Perl Modules by James Golovich so the $AGI->channel_status('Zap/1-1') returns 4 and the $AGI->channel_status('Sip/2400') returns -1.
I think that a major problem with the Channel Status is that the Sip channel is not being correctly provided. Since it seems to work with the Zap channel. The code is walking the channels to do a strcmp for an exact match. I'm lost to find out what the Sip channel designator should look like.
It appears that the ChanIsAvail would be the correct call to make for this purpose.
Last, I can't get the options to work with the $AGI->exed('Dial', $newvar , '30,t'); command. It seems to ignore the options, so, I can't tell the dial command how long to ring and to allow the called extension to transfer.
TIA, Walker
Here are some snips from my conf files and agi script:
myagi.agi
...
for $i ( split /,/,$ARGV[0] ) {
if ( $AGI->exec('ChanIsAvail', $i) == 0 ) {
if ( $count++ > 0 ) { $newvar .= "\&" };
$newvar .= $i;
$result = $AGI->channel_status($i); # always returns -1
print STDERR "$result\n";
}
}
$result = $AGI->channel_status('Zap/1-1'); # test this with Zap
print STDERR "$result\n"; # always returns 4
$AGI->exec('Dial', $newvar , '30,t'); # this is supposed to dial the
# extensions that are "not busy"
...
sip.conf
...
[2400] ; Grandstream Phone
context=intern
type=friend
insecure=yes
host=dynamic
permit=192.168.254.0/255.255.255.0
mailbox=2400
dtmfmode=inband
canreinvite=no
nat=no
...
extensions.conf
...
PHONE2=SIP/2400
PHONE3=SIP/2410
RECEPTION=${PHONE2},${PHONE3}
...
exten => 2200,1,AGI(myagi.agi,${RECEPTION})
...
console (asterisk -vvvvvvvc)
...
-- Executing AGI("Zap/1-1", "myagi.agi|SIP/2400,SIP/2410") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/myagi.agi
arg1 = SIP/2400,SIP/2410
Channel Status:
-- AGI Script Executing Application: (ChanIsAvail) Options: (SIP/2400)
-1
-- AGI Script Executing Application: (ChanIsAvail) Options: (SIP/2410)
-1
4
-- AGI Script Executing Application: (Dial) Options: (SIP/2400&SIP/2410)
-- Called 2400
-- Called 2410
-- SIP/2400-3320 is ringing
-- SIP/2410-a8ca is ringing
...
--
******** DataCrest, Inc. -- Technically Superior ******************
Walker Haddock http://www.datacrest.com
DataCrest, Inc. e-mail: wh at datacrest.com
1634A Montgomery Hwy. phone: 1-888-941-3282, 1-205-335-8589
Birmingham, AL 35216 fax: 1-205-823-7838
***********************************************************************
--
******** DataCrest, Inc. -- Technically Superior ******************
Walker Haddock http://www.datacrest.com
DataCrest, Inc. e-mail: wh at datacrest.com
1634A Montgomery Hwy. phone: 1-888-941-3282, 1-205-335-8589
Birmingham, AL 35216 fax: 1-205-823-7838
***********************************************************************
More information about the asterisk-users
mailing list