[asterisk-users] Cannot originate to extension unless /etc/hosts is edited constantly?

Tony Mountifield tony at softins.co.uk
Tue Jan 15 11:32:40 CST 2019


In article <018201d4acef$898a4b10$9c9ee130$@verishare.co.za>,
Stefan Viljoen <viljoens at verishare.co.za> wrote:
> Hi Guys
> 
> I've run into a weird problem on Asterisk 13. Again something that worked fine on 1.8 but is now broken on Asterisk 13.
> 
> I have an extension 3015. I'm trying to originate a recording playback call on it via AMI by sending
> 
> Action: Originate
> ActionID: test
> Channel: SIP/3015
> Exten: 7777
> Context: local
> Priority: 1
> CallerID: 3015
> Account: recordinglisten
> ChannelID: abc
> OtherChannelID: def
> Variable: CallLimit=3600,recfile=/var/spool/asterisk/monitor/1807/25/2507180836591192526,altfile=/var/spool/asterisk/monitor/archive/1807/25/2507180836591192526
> Async: true
> 
> My dialplan code:
> 
> exten=>7777,1,Answer()
> exten=>7777,n,NoOp(Requesting File ${recfile})
> exten=>7777,n,Set(${__recfile}=${recfile})
> exten=>7777,n,Set(${__altfile}=${altfile})
> exten=>7777,n,NoOp(Rec file set to ${recfile})
> exten=>7777,n,NoOp(Alt file set to ${altfile})
> exten=>7777,n,NoOp(Requesting Alt File ${altfile})
> exten=>7777,n,Set(__numbertarget=7777)
> exten=>7777,n(play),ControlPlayback(${recfile},20000,6,4,8,5,9)
> exten=>7777,n(play2),ControlPlayback(${altfile},20000,6,4,8,5,9)
> exten=>7777,n,hangup()
> 
> However, on sending the above to the AMI I get in the console of Asterisk 13:
> 
> [Jan 15 18:19:23] ERROR[10519]: netsock2.c:305 ast_sockaddr_resolve: getaddrinfo("local", "(null)", ...): Name or service not known
> [Jan 15 18:19:23] WARNING[10519]: chan_sip.c:6316 create_addr: No such host: local
> 
> and no recording playback takes place.
> 
> I've found that by editing /etc/hosts and adding
> 
> 172.56.4.11  local
> 
> where 172.56.4.11 is the phone SIP/3015's IP address, it works perfectly and the recording starts playing once 3015 is answered.

What does your sip.conf look like? (without comments, e.g. grep -v '^;' sip.conf | grep -v '^$')

Particularly, do you have a separate section for each phone, e.g. [3015] ?

> On Asterisk 1.8 the above worked without having to constantly edit /etc/hosts and having to constantly map and remap the one phone that is then capable of playing back a recording.
> 
> This appears to be some kind of DNS / name resolution issue exclusive to Asterisk 13 (for me) - how can I fix this, e. g. NOT get
> 
> [Jan 15 18:19:23] ERROR[10519]: netsock2.c:305 ast_sockaddr_resolve: getaddrinfo("local", "(null)", ...): Name or service not known
> [Jan 15 18:19:23] WARNING[10519]: chan_sip.c:6316 create_addr: No such host: local
> 
> and constantly having to edit /etc/hosts to get one of my phones (the one tied to "local") to be able to play back a recording on Asterisk 13?
> 
> (This obviously is fatal anyway as I got lots of phones on which I want to playback recordings and editing /etc/hosts for each phone is impossible if two phones want to listen to different recordings at the same time- /etc/hosts can only contain one "local").
> 
> How can I fix this?

I don't understand why it should be trying to look up the address of "local".
If you change your dialplan context to another name and refer to that name in
Context in your original request, does it try looking up this new name, or
still "local"?

Cheers
Tony
-- 
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org



More information about the asterisk-users mailing list