Im having this problem just when i answer the phone and then hangup, but asterisk does not detect the hangup while AMD is detecting ?
Asterisk 11.11
-- Executing [09XXXXXXXX#appel-sortant:10] NoOp("Local/09XXXXXXXX#appel-sortant-40f9;2", "Next = 0") in new stack
-- Executing [09XXXXXXXX#appel-sortant:11] Set("Local/09XXXXXXXX#appel-sortant-40f9;2", "GLOBAL(NEXT)=0") in new stack
== Setting global variable 'NEXT' to '0'
-- Executing [09XXXXXXXX#appel-sortant:12] Dial("Local/09XXXXXXXX#appel-sortant-40f9;2", "SIP/09XXXXXXXX#forfait-ovh,20,gtr") in new stack
== Using SIP RTP CoS mark 5
-- Called 09XXXXXXXX#forfait-ovh
-- SIP/forfait-ovh-00000000 is ringing
-- SIP/forfait-ovh-00000000 is making progress passing it to Local/09XXXXXXXX#appel-sortant-40f9;2
-- SIP/forfait-ovh-00000000 answered Local/09XXXXXXXX#appel-sortant-40f9;2
> Channel Local/09XXXXXXXX#appel-sortant-40f9;1 was answered.
-- Executing [s#appel-sortant:1] Playback("Local/09XXXXXXXX#appel-sortant-40f9;1", "silence/1") in new stack
-- <Local/09XXXXXXXX#appel-sortant-40f9;1> Playing 'silence/1.gsm' (language 'en')
== Spawn extension (appel-sortant, 09XXXXXXXX, 12) exited non-zero on 'Local/09XXXXXXXX#appel-sortant-40f9;2'
-- Executing [s#appel-sortant:2] AMD("SIP/forfait-ovh-00000000", "") in new stack
-- AMD: SIP/forfait-ovh-00000000 09XXXXXXXX (null) (Fmt: 64)
-- AMD: initialSilence [2500] greeting [1500] afterGreetingSilence [800] totalAnalysisTime [5000] minimumWordLength [100] betweenWordsSilence [50] maximumNumberOfWords [3] silenceThreshold [256] maximumWordLength [5000]
-- AMD: Channel [SIP/forfait-ovh-00000000]. Changed state to STATE_IN_SILENCE
-- AMD: Channel [SIP/forfait-ovh-00000000]. HANGUP
[Aug 31 09:19:35] NOTICE[32712]: pbx_spool.c:349 attempt_thread: Call completed to Local/09XXXXXXXX#appel-sortant
extensions.conf
exten => s,1,Playback(silence/1)
exten => s,n,AMD()
exten => s,n,NoOp(AMDSTATUS = ${AMDSTATUS})
exten => s,n,GotoIf($[${AMDSTATUS}=MACHINE]?appel-sortant-mach,s,1:appel-sortant-humn,s,1)
I resolved the problem implementing the hangup handler.
Hangup Handlers
Asterisk DO detect hangup on called party ALWAYS.
There are no way prevent that.
Check your provider/FXO gate, probably it just not detect hangup.
Related
Here is my sample dialplan
exten => _X.,1,Progress()
exten => _X.,n,Playback(welcome,noanswer)
exten => _X.,n,Hangup()
When I tried to call through dhadi channel. I am getting the below logs in asterisk console.
-- Accepting call from '9042394773' to '33468550' on channel 0/8, span 1
-- Executing [33468550#test:1] Progress("DAHDI/i1/9042394773-8", "") in new stack
-- Executing [33468550#test:2] Playback("DAHDI/i1/9042394773-8", "welcome,noanswer") in new stack
-- <DAHDI/i1/9042394773-8> Playing 'welcome.slin' (language 'en')
-- Executing [33468550#test:3] Hangup("DAHDI/i1/9042394773-8", "") in new stack
-- Hungup 'DAHDI/i1/9042394773-8'
But the welcome voice is not audio able.. How do I play weclome voice before atten the call??? Whether I have to change any configuration in asterisk????
Am using asterisk 13.5.
I found this example where a Wait(1) is used between Progress and Playback.
Maybe you can give it a try.
exten => 500,1,Progress()
exten => 500,n,Wait(1)
exten => 500,n,Playback(WeAreClosedGoAway,noanswer)
exten => 500,n,Hangup()
I've an asterisk pbx that manages some sip providers (a ISDN Patton) and some Voip providers.
I'm trying to use matching of CID in my dialplan as described here.
This is the relevant part of my dialplan, please note that this part of dialplan is included my extension.conf:
[patton];Calls from Patton
exten => 0219999999/_0031X.,1,Answer(0)
exten => 0219999999/_0031X.,n,Hangout()
exten => 0219999999,1,Answer(0)
exten => 0219999999,n,Goto(in_4,${EXTEN},1)
[in_4]
exten => 0219999999,1,Noop(Exten: ${EXTEN})
exten => 0219999999,n,Noop(CID: ${CALLERID(NUM)})
In short I want do something different when the CID of the caller cames from Netherlands.
Watching what happens in Asterisk CLI I see:
== Using SIP RTP CoS mark 5
-- Executing [0219999999#patton:1] Answer("SIP/patton-00000011", "0") in new stack
-- Executing [0219999999#patton:2] Goto("SIP/patton-00000011", "in_4,0219999999,1") in new stack
-- Goto (in_4,0219999999,1)
-- Executing [0219999999#in_4:1] NoOp("SIP/patton-00000011", "Exten: 0219999999") in new stack
-- Executing [0219999999#in_4:2] NoOp("SIP/patton-00000011", "Cid: 0031123456789") in new stack
So what I understand is that Asterisk don't apply the CID matching but I don't understand why, considering that if I print the CID it matches perfectly my expression.
Here is a section of my extensions.conf file that deals with inbound caller ID matching (from a PSTN line)
There might be another/better way to do this, but its been a working config for me since 1.4 and I'm now running 13.7 without any issues. (Individual numbers have been replaced with '#') - This is a simple dial plan.
This is used to catch anyone who send an 084 or 087 prefix, a couple of specific numbers and anything from 'international' or lazy system administrators 'UNAVAILABLE'
I've the same thing set up for SIP trunks as well so this should work across any channel type.
[from-pstn]
exten => s,1,Verbose(CLID From BT ${CALLERID(all)})
exten => s,2,GotoIf($[${CALLERID(num):0:3} = 087]?103:3)
exten => s,3,GotoIf($[${CALLERID(num):0:3} = 084]?103:4)
exten => s,4,GotoIf($[${CALLERID(num):0:11} = 07896######]?103:5)
exten => s,5,GotoIf($[${CALLERID(num):0:11} = 01494######]?103:6)
exten => s,6,GotoIf($["${CALLERID(name):0:13}" = "INTERNATIONAL"]?103:7)
exten => s,7,GotoIf($["${CALLERID(name):0:11}" = "UNAVAILABLE"]?103:8)
exten => s,8,GotoIf($[${CALLERID(num):0:10} = 020315####]?103:9)
exten => s,103,Answer
exten => s,104,Wait(1)
exten => s,105,Playtones(info)
exten => s,106,Wait(7)
exten => s,107,Hangup
exten => s,9,Goto(internal-ext,5800,1)
You would want something like;
[from-yourtrunk]
exten => s,1,Verbose(CLID From <yourtrunk> ${CALLERID(all)})
exten => s,2,GotoIf($[${CALLERID(num):0:4} = 0031]?103:3)
exten => s,103,<do something with the call that matches the CLI>
exten => s,3,Goto(<your-internal-ext>,<number>,1)
Something to keep in mind - if you handle inbound caller ID that could start 0031 but its not a call from .nl then you would need to apply some additional patten matching to the 2nd line to enforce a minimum number of digits (for example) otherwise that will match any call that comes in with a CLI of 0031...............................
If you need any more explanation, or I've got the wrong end of the stick just add a comment to this answer.
There can be non zero probability, that cid is go in other format(use Verbose or Noop command to show real cid)
Also in this case any dialplan can work if cid match
Asterisk not select "most matching" dialplan. Insead it select FIRST matching dialplan.
You can use different contexts and include directive to control matching. See examples in extensions.conf.sample
-- Executing [19#test:1] Answer("SIP/test2-0000821a", "") in new stack
-- Executing [19#test:2] Set("SIP/test2-0000821a", "CALLERID(num)=0031123456789") in new stack
-- Executing [19#test:3] Goto("SIP/test2-0000821a", "patton,0219999999,1") in new stack
-- Goto (patton,0219999999,1)
-- Executing [0219999999#patton:1] Answer("SIP/test2-0000821a", "0") in new stack
[Feb 10 08:26:09] WARNING[15817][C-00008bfe]: pbx.c:4869 pbx_extension_helper: No application 'Hangout' for extension (patton, 0219999999, 2)
== Spawn extension (patton, 0219999999, 2) exited non-zero on 'SIP/test2-0000821a'
[Feb 10 08:26:45] NOTICE[1499]: chan_sip.c:28210 handle_request_register: Registration from '"407" <sip:407#78.47.159.180:5060>' failed for '221.144.172.3:5083' - Wrong password
pro-sip*CLI> dialplan show pa
park-dial park-hints park-orphan-routing park-return-routing parkedcalls parkedcallstimeout
patton
pro-sip*CLI> dialplan show patton
[ Context 'patton' created by 'pbx_config' ]
'0219999999' (CID match '_0031X.') => 1. Answer(0) [pbx_config]
2. Hangout() [pbx_config]
'0219999999' => 1. Answer(0) [pbx_config]
2. Goto(in_4,${EXTEN},1)
[pbx_config] pro-sip*CLI> core show applications like Hang
-= Matching Asterisk Applications =-
ChangeMonitor: Change monitoring filename of a channel.
Hangup: Hang up the calling channel.
HangupCauseClear: Clears hangup cause information from the channel that is available through HANGUPCAUSE.
SoftHangup: Hangs up the requested channel.
-= 4 Applications Matching =- pro-sip*CLI>
Addon2(please note, debug is OFFTOPIC on SO)
-- Executing [0219999999#patton:1] NoOp("SIP/test2-0000821c", "cid match") in new stack
-- Executing [0219999999#patton:2] Answer("SIP/test2-0000821c", "0") in new stack
[Feb 10 08:32:18] WARNING[15826][C-00008c00]: pbx.c:4869 pbx_extension_helper: No application 'Hangout' for extension (patton, 0219999999, 3)
== Spawn extension (patton, 0219999999, 3) exited non-zero on 'SIP/test2-0000821c'
pro-sip*CLI> dialplan show pa
park-dial park-hints park-orphan-routing park-return-routing parkedcalls parkedcallstimeout
patton
pro-sip*CLI> dialplan show patton
[ Context 'patton' created by 'pbx_config' ]
'0219999999' (CID match '_0031X.') => 1. Noop(cid match) [pbx_config]
2. Answer(0) [pbx_config]
3. Hangout() [pbx_config]
'0219999999' => 1. NOOP(CIDNOTMATCH) [pbx_config]
2. Answer(0) [pbx_config]
3. Goto(in_4,${EXTEN},1) [pbx_config]
I just started to play around with asterisk. Currently it is installed on CentOS 7 and version of Asterisk is 13.
This is what I get when I call directly to voicemail from Zoiper
-- Executing [8500#demo:2] VoiceMailMain("SIP/2001-00000028", "#demo") in new stack
-- <SIP/2001-00000028> Playing 'vm-login.gsm' (language 'en')
-- <SIP/2001-00000028> Playing 'vm-password.gsm' (language 'en')
-- Incorrect password '' for user '2001' (context = demo)
-- <SIP/2001-00000028> Playing 'vm-incorrect-mailbox.gsm' (language 'en')
....
This is what I have in extension.conf
exten => 8500,1,Answer
exten => 8500,2,VoiceMailMain()
exten => 8500,3,Hangup()
This is in voicemail.conf
[demo]
2001 => Demo Test, demo#127.0.0.1
and this is the user in sip.conf
[general]
port = 5060
bindaddr = xxx.xxx.xxx.xxx
allow=all
context = bogon-calls ; Send SIP callers that we don't know about here
[2001]
type=friend ; This device takes and makes calls
username=demo_test ; Username on device
secret=1234 ; Password for device
host=dynamic ; This host is not on the same IP addr every time
context=demo ; Inbound calls from this host go here
mailbox=100
In /var/lib/asterisk/sounds/en are all the .gsm files..
Check firewall rtp ports(see rtp.conf for port list)
I have implemented a simple blacklist for my incoming calls. The problem I am having is that my phone is no longer ringing when a blacklister calls(this part is good), but the blacklisted phone doesn't hang up (this is the problem).
Incoming context in extensions.conf:
exten => 12225551234,1,Zapateller(nocallerid)
same => n,GotoIf(${BLACKLIST()}?hangup)
same => n,Dial(SIP/myphone)
same => n(hangup),Hangup()
Add a number to blacklist:
CLI> database put blacklist +14445554321 "Blacklisted for testing"
Call 12225551234 from blacklisted 14445554321...
As seen via CLI interface:
== Using SIP RTP CoS mark 5
-- Executing [12225551234#from-sipProvider:1] GotoIf("SIP/sipProvider_did9-00000738", "1?hangup") in new stack
-- Goto (from-sipProvider,12225551234,5)
-- Executing [12225551234#from-sipProvider:5] Hangup("SIP/sipProvider_did9-00000738", "") in new stack
== Spawn extension (from-sipProvider, 12225551234, 5) exited non-zero on 'SIP/sipProvider_did9-00000738'
== Using SIP RTP CoS mark 5
-- Executing [12225551234#from-sipProvider:1] GotoIf("SIP/sipProvider_did10-00000739", "1?hangup") in new stack
-- Goto (from-sipProvider,12225551234,5)
-- Executing [12225551234#from-sipProvider:5] Hangup("SIP/sipProvider_did10-00000739", "") in new stack
== Spawn extension (from-sipProvider, 12225551234, 5) exited non-zero on 'SIP/sipProvider_did10-00000739'
== Using SIP RTP CoS mark 5
-- Executing [12225551234#from-sipProvider:1] GotoIf("SIP/sipProvider_did9-0000073a", "1?hangup") in new stack
-- Goto (from-sipProvider,12225551234,5)
-- Executing [12225551234#from-sipProvider:5] Hangup("SIP/sipProvider_did9-0000073a", "") in new stack
== Spawn extension (from-sipProvider, 12225551234, 5) exited non-zero on 'SIP/sipProvider_did9-0000073a'
This continues until the blocked caller hangs up. Eventually, after about 50 seconds, if the caller hasn't hung up he hears ringing. I need to hang up his phone or I will be charged if he leaves the phone off the hook.
Try answering the call before hanging up. This is what I use:
exten => 12225551234,1,Zapateller(nocallerid)
same => n,GotoIf(${BLACKLIST()}?badlist,s,1)
same => n,Dial(SIP/myphone)
same => n,Hangup()
[badlist]
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(ss-noservice)
exten => s,n,Hangup
I want to send both caller and callee to meetme room.But its not working fine.This is my code:
[USER_CALL]
exten => s,1(start),Answer()
exten => s,n,Set(TIMEOUT(absolute)=45)
exten => s,n,Dial(SIP/20000,,G(chat-room,add,1))
[chat-room]
exten => add,1,Set(TIMEOUT(absolute)=45)
exten => add,n,MeetMe(${CALLERID(num)},mt,unmute})
It show me follwing output:
== Using SIP RTP CoS mark 5
-- Called 20000
-- SIP/20000-0a9e8710 is ringing
-- SIP/20000-0a9e8710 is ringing
-- SIP/20000-0a9e8710 answered SIP/923028111415-b741da98
-- Executing [add#chat-room:1] Set("SIP/923028111415-b741da98", "TIMEOUT(absolute)=45") in new stack
Channel will hangup at 2014-08-25 14:27:29.306 PKT.
-- Executing [add#chat-room:2] MeetMe("SIP/923028111415-b741da98", "923028111415,mt,unmute}") in new stack
== Parsing '/etc/asterisk/meetme.conf': == Found
== Spawn extension (chat-room, add, 2) exited non-zero on 'SIP/923028111415-b741da98'
-- Executing [add#chat-room:2] MeetMe("SIP/20000-0a9e8710", "s,mt,unmute}") in new stack
== Parsing '/etc/asterisk/meetme.conf': == Found
== Spawn extension (chat-room, add, 2) exited non-zero on 'SIP/20000-0a9e8710'
Please guide me through it.
Seams you are triing to do n-way-call.
Check this for more info
http://www.voip-info.org/wiki/view/Asterisk+n-way+call+HOWTO
Please also not if you dooing it via G
G([[context^]exten^]priority): If the call is answered, transfer
the calling party to the specified <priority> and the called party to
the specified <priority> **plus one.**
Hangup in your log most likly becuase of no dahdi module working on your system(meetme app require dahdi be availible) or becuase no room like you described availible(maybe need use d flag)