[asterisk-users] Can I emulate SIP presence for an extension?
Ade Vickers
javickers at solutionengineers.com
Sat Oct 20 09:41:05 CDT 2007
I wrote:
> So, is there any way of monitoring the status of a device on
> a "remote"
> server, perhaps utilising an IAX2 channel?
To answer my own question, I did it :)
In case anyone's remotely interested in a similar setup/idea, here's the
relevant bits of my dialplan.
Assume that a call, having been answered, now needs dumping in the
"telemarketer tarpit of death"....
Up in default, I have the following defined:
exten => 5555,hint,custom:telepark
So, that sets up the custom:telepark "device", which will be either busy or
idle.
On serverA (local), I have this extension defined:
;Death to telemarketers
exten => 5555,1,Goto,teledeath|s|1
That jumps into the teledeath context, defined as:
[teledeath]
exten => s,1,Answer()
exten => s,2,Set(DEVSTATE(Custom:telepark)=INUSE)
exten => s,3,Dial(IAX2/serverC/teledeath_on)
exten => s,4,WaitMusicOnHold(15)
exten => s,5,Wait(1.5)
exten => s,6,Playback(pls-hold-while-try)
exten => s,7,Wait(0.25)
exten => s,8,Goto,4
exten => h,1,Set(DEVSTATE(Custom:telepark)=NOT_INUSE)
exten => h,n,Dial(IAX2/serverC/teledeath_off)
exten => h,n,Hangup()
Step 2 sets the custom:telepark to be in use (lighting the lamp on anything
connected to serverA(local) which is watching extension 5555).
Step 3 calls the extension teledeath_on on the remote server (serverC)
Steps 4-8 keep the telemarketer busy...
When they finally give up, exten h is called:
Step 1 simply re-sets the device state
Step 2 calls extension teledeath_off on the remote server
Meanwhile, on my remote server, I simply define a SIP hint:
exten => 5555,hint,Custom:teledeath
and two extensions:
;Death to telemarketers status marker
exten => teledeath_on,1,Set(DEVSTATE(Custom:teledeath)=INUSE)
exten => teledeath_on,n,Set(HANGUPCAUSE=17)
exten => teledeath_on,n,Hangup()
exten => teledeath_off,1,Set(DEVSTATE(Custom:teledeath)=NOT_INUSE)
exten => teledeath_off,n,Hangup()
Note that the middle step of teledeath_on is required to prevent the local
server from seeing a "caller hung up" event; which would otherwise cause the
music to stop & the telemarketer to be disconnected; which is not what we
want to happen...
The only problem with this scheme occurs if I do something stupid:
1) Dial 5555 from any of the connected phones (goes to teledeath loop)
2) Hit transfer, dial 5555 & send
3) Now I've got a call locked in the system, constantly trying to play music
to itself....
Any ideas on how I could prevent it doing that?
Cheers,
Ade.
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.488 / Virus Database: 269.15.3 - Release Date: 19/10/2007 00:00
More information about the asterisk-users
mailing list