[asterisk-users] Cannot originate to extension unless /etc/hosts is edited constantly? [Tony Mountfield]
Stefan Viljoen
viljoens at verishare.co.za
Tue Jan 15 12:26:54 CST 2019
Hi Tony
Ok, got this solved.
<high embarrassment factor>
I discovered my AMI message was corrupt due to a bug in our third party dialer app we wrote ourselves...!
E. g. this worked on Asterisk 1.8:
ActionID=12edad43-e817-427b-aa21-31a9659f86e1
&Action=Originate
&Channel=SIP/local/3035 at local
&Exten=7777
&Context=local
&Priority=1
&CallerID=3035
&Account=recordinglisten
&ChannelID=12edad43-e817-427b-aa21-31a9659f86e1
&OtherChannelID=12edad43-e817-427b-aa21-31a9659f86e1B
&Variable=CallLimit=3600,recfile=/var/spool/asterisk/monitor/archive/1901/15/201901151654r1g4679,altfile=/var/spool/asterisk/monitor/archive/1901/15/201901151654r1g4679
&Async=true
But doesn't on Asterisk 13 - for a very good reason:
&Channel=SIP/local/3035 at local
was acceptable to Asterisk 1.8, but NOT to Asterisk 13 - and I kind of agree.
It was a bug in our third party dialer app that instead of passing to Asterisk 13
&Channel=SIP/3035 at local
was passing
&Channel=SIP/local/3035 at local
which is just WRONG.
This was why 13 was replying
[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
which makes perfect sense...!
So I fixed the incorrect variable reference in our app that was generating the wrong
SIP/local/3035 at local
channel, and recording playback started working correctly and no more of the above error messages.
So all not Asterisk fault, though 13 does appear to interpret the channel name differently as
SIP/local/3035 at local
DOES work on 1.8.32.3 (which it shouldn't, but it does.)
Thanks for taking the time to reply.
</high embarrassment factor>
Regards
Stefan
---
Date: Tue, 15 Jan 2019 17:32:40 +0000 (UTC)
From: tony at softins.co.uk (Tony Mountifield)
To: asterisk-users at lists.digium.com
Subject: Re: [asterisk-users] Cannot originate to extension unless
/etc/hosts is edited constantly?
Message-ID: <assp.091838c559.q1l5fo$g7k$1 at softins.softins.co.uk>
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
------------------------------
Subject: Digest Footer
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
Check out the new Asterisk community forum at: https://community.asterisk.org/
New to Asterisk? Start here:
https://wiki.asterisk.org/wiki/display/AST/Getting+Started
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
------------------------------
End of asterisk-users Digest, Vol 173, Issue 15
***********************************************
More information about the asterisk-users
mailing list