I'm using Asterisk 11. I have a problem to get channel name when I attempt to call-out.
Usually, I can get the channel name when the called party picks up his/her phone. But now, I would like to get the channel name right after I dial out. I can see it on the screen like this:
Called SIP/7146991234#64.195.139.88
- SIP/64.195.139.88-00000001 is ringing
-- SIP/64.195.139.88-00000001 is making progress passing it to SIP/8001-00000000
I know that the channel name is : "SIP/64.195.139.88-00000001",
but I don't know how to get it from coding or any other ways.
Please help me.
Thank you very much!
You can get the name of the outbound channel in Asterisk 11 using a Pre-Dial Handler on the called channel.
[default]
exten => pre_dial_handler,1,NoOp()
same => n,Verbose(1, Channel is ${CHANNEL})
same => n,Return()
exten => dial_example,1,NoOp()
same => n,Dial(SIP/alice,,b(default^pre_dial_handler^1)
This will execute the subroutine pre_dial_handler on channel SIP/alice-XXXXXXXX, as opposed to whatever channel is actually performing the dial operation. The subroutine is executed on the outbound channel immediately after creation but before any operation is taken on it, such as making a call attempt.
You can't get channel name of outbound channel in dialplan
Reason: it not created yet at that moment.
But you can get it by external application by checking variables BRDIGEDPEERNAME or listnen event.
Also you can get both channels in cmd_dial internal macro(M param)
Related
As a beginner that just installed his first asterix server I came across a small issue. i want to check if a number that i dial is busy or not before actually dialing it.
So for example I would call 0904 => number busy => redirect to 0905
However I don't want it to dial 0904 first if its busy but just instantly redirect it to 0905 instead.
I have a very basic setup with just 3 users. 2 of them are in a queue "support" one of them is in the queue "admin"
I have seen and read a little about checking if a channel is available but i didn't fully understand that and I'm not sure if it could be done easier.
Here is my simple dialplan, if i call *12 my simple python script will just execute the Dial command to the 0904.
exten => *12,1,Answer()
same => n,set(PHONE_EXTEN=0904)
same => n,AGI(test-agi.py,${PHONE_EXTEN})
same => n,Hangup()
There is no way know if external number is busy.
If number is your extension, you can count calls using GROUP/GROUP_COUNT or you can check extensions states and hints, like described in docs
https://wiki.asterisk.org/wiki/display/AST/Extension+State+and+Hints
https://wiki.asterisk.org/wiki/display/AST/Device+State
Using Asterisk 11, with an inbound route configured to call Queue app, every time the caller hangs up the HANGUPCAUSE variable is 0, it works and returns the NORMAL_CLEARING code only when the assigned queue member hangs up or if not using queues. Example code:
[from-trunk]
exten => s,1,Answer()
same => n,Queue(queue-1,rkt,,,30)
exten => h,1,Verbose(Hangup cause is ${HANGUPCAUSE})
How to obtain a valid HANGUPCAUSE from calls answered with queues?
Asterisk HANGUP_CAUSE will show you only value of last Dial command and only for SOME channel types.
Queue generate 100500 of NEW calls and bridge it together to make functionality you want.
You can check cause in queue's branches(in each one can be DIFFERENT), using agents in Local/ channels.
You can use Queue app variables:
This application sets the following channel variables upon completion:
${QUEUESTATUS}: The status of the call as a text string.
TIMEOUT
FULL
JOINEMPTY
LEAVEEMPTY
JOINUNAVAIL
LEAVEUNAVAIL
CONTINUE
${ABANDONED}: If the call was not answered by an agent this variable will be
TRUE.
You also can use queue_log or CDRs.
Here is my scenario i want to achieve, I have do outbound call to a number, after conversation i need to transfer the call to play a message for callee. After the message end, the call will route back to caller continue conversation.
How am i going to achieve this. using method MeetMe? or others?
Dialplan should be something like this:
[default]
exten => _10XX,1,Dial(SIP/${EXTEN})
After the conversation if the user transfer the call to "Music" extensions: (from sip client i guess):
[Music]
exten => _X.,n,Playback(your_play_file)
exten => _X.,n,Dial(SIP/${EXTEN})
better if you can manipulate using AGI to get/set the user was talking to the caller.
alternate:
you can use Call Parking for this.
Scenario:
Asterisk receives incoming call to a DID number
Asterisk forwards incoming call to a mobile number using PSTN termination.
Call is answered on a mobile
Question:
Is there a possibility to transfer call to a different extension during the call ?
yes,but require guru level.
it can be done by writing special application or using conference or using AMI.
probably easy way is conference
Yes. This is very straight forward.
Presuming your DID is 1-234-567-8900 and your moble is 1-987-654-3210:
exten => _12345678900,1,NoOp(Call for DID to Mobile)
same => n, Dial(DAHDI/g1/19876543210,30,t)
same => n, HangUp()
The dial option "t" allows "...the called user to transfer the call by hitting the blind xfer keys (features.conf)"
Further reading: http://www.voip-info.org/wiki/view/Asterisk+cmd+Dial
I have an asterisk server. I use the server to connect an incoming call to another extension based on a few key presses. There is a certain time lag (after the key/extension press and before the call connects). How can I play a small music file (of my choice) in this period? There are some constraints that come to my mind:
The music should play only as long as the call does not connect. So, the method used should be a non-locking one.
Any help on this is most welcome.
Thanks,
Sriram
Use the m flag to the Dial application, to play music on hold while the call is connecting.
exten => 9000,1,Noop
exten => 9000,n,Answer
exten => 9000,n,Dial(SIP/device,0,m)
I think Background is your friend (http://www.voip-info.org/wiki/view/Asterisk+cmd+BackGround)