Hello everyone,
I have a headache which I have been trying to solve for the last several nights without success.
My setup is : FreePBX 2.9.0.12 + Asterisk 1.8.15 + A2Billing 1.9.4 (Cuprum).
I need to setup a chanspy or extenspy functionality when one of two things happens: - an internal office user dials "999" - a user dials one of our external DID numbers (lets say for the sake of this example, that the external did number is 1122334455)
Preferably extenspy because the spied on extension is registered, but not always bridged, so the spying user has to wait on the line and NOT get disconnected , even after the spied on user makes a call, finishes it and hangs up, waits a few minutes and makes another call. The spying user has to hear it all.
Back when I was just doing it with Asterisk, this would have been easy: I would stick this in the [internal] context (all office users have this as their default context):
todayspassword=1234 hard-coded-user-to-spy-on=johnsmith exten => 999,1,Authenticate(${todayspassword}) exten => 999,n,Playback(ring) exten => 999,n,Wait(1) exten => 999,n,ExtenSpy(SIP/${hard-coded-user-to-spy-on}) exten => 999,n,Hangup
And I would stick this in the [incoming] context (as all incoming pstn traffic lands in this context by default): todayspassword=1234 hard-coded-user-to-spy-on=johnsmith exten => _1122334455,1,Authenticate(${todayspassword}) exten => _1122334455,n,Playback(ring) exten => _1122334455,n,Wait(1) exten => _1122334455,n,ExtenSpy(SIP/${hard-coded-user-to-spy-on}) exten => _1122334455,n,Hangup
OK, so from the above, You can see what I am trying to do / run some custom dialplan commands for both office users as well as incoming pstn traffic.
What I did in my a2b setup, which partly worked:
To get the "999" internal extenspy functionality, i put this code at the beginning of extensions_a2billing.conf in the beginning of the [a2billing] context:
todayspassword=1234 hard-coded-user-to-spy-on=johnsmith exten => 999,1,Authenticate(${todayspassword}) exten => 999,n,Playback(ring) exten => 999,n,Wait(1) exten => 999,n,ExtenSpy(SIP/${hard-coded-user-to-spy-on}) exten => 999,n,Hangup
And it worked. The spying user would connect, wait for the spiedon user to bridge a call, listen to it, the spied-on user would disconnect, then brodge another call the the spying user would hear it all. I dont know whether this is the neatest way to do it, but it worked.
But I could not get the incoming calls (from pstn) to get the same. I did all kinds of nasty things / I setup an INCOMING DID Destination that would redirect traffic from the external DID number 1122334455 to a destination like local/999@a2billing, but this would give strange results: upon the call being made, the dialing user would hear a "local 999" recording, and then sometimes extenspy would work, but not always. The spying user would get either disconnected when the spied-on user would end their call or would hear "IAX" recording but would not be able to spy on the next call even though it was made. And always, the spying user would hear nothing if at the time of making their call, the spied on user would not have a call bridged. The results were pretty chaotic so I dont want to write them all down , because they might confuse the reader.
My question in a nutshell / what is the best way to run custom dialplan code when a call from the outside PSTN is made to a known and dedicated external pstn number like our example 1122334455 ? The above is ok minus a few bugs (incoming did destination to local/999@a2billing) , or am I completely off the track ?
thanks, Marcin
|