[asterisk-users] Dial() using full SIP account details

Antony Stone Antony.Stone at asterisk.open.source.it
Wed Mar 1 03:31:58 CST 2017


Hi.

I'm having problems with the Dial() application when I use full SIP account 
details in it.

I'm looking at the O'Reilly book https://www.amazon.co.uk/dp/1449332420 on 
page 135, where it says "The Dial() application also allows you to connect to 
a remote VoIP endpoint not previously defined in one of the channel 
configuration files.  The full syntax is:

Dial(technology/user[:password]@remotehost[:port][/remote_extension])

As an example, you can dial into a demonstration server at Digium using the 
IAX2 protocol by using the following extension:

exten => 500,1,Dial(IAX2/guest at misery.digium.com/s)"


I'm using Asterisk 11.13.1 under Debian 7.

I am trying to dial from Asterisk to another SIP server using an account on 
that server, for which I know the username and password.

Just to confirm, if I put the account credentials into a telephone and register 
to the remote server, I can place calls as expected.

When I try to do the same thing using Asterisk, however:

1. The password I have been assigned on the remote server contains a ! symbol, 
and it seems that Asterisk is ignoring this symbol and everything after it:

The account name (slightly obfuscated for security in this email) is 832+ios
The password (ditto) is 31oNPMLQ!9d_XuQu
I wish to dial through that account to the number 0203xxxxyyyy (which works 
from a telephone).

In my dialplan I have (all on one line of course):

exten => 936,1,Dial(SIP/832+ios:31oNPMLQ!
9d_XuQu at remote.server.com/0203xxxxyyy)

Dialling extension 936 results in:

-----
    -- Executing [936 at outbound:1] Dial("SIP/1000-000000db", 
"SIP/832+ios:31oNPMLQ!9d_XuQu at remote.server.com/0203xxxxyyy") in new stack

  == Using SIP RTP CoS mark 5

[2017-02-28 11:38:16] ERROR[1005][C-00000d21]: netsock2.c:269 
ast_sockaddr_resolve: getaddrinfo("832+ios", "31oNPMLQ", ...): Servname not 
supported for ai_socktype

[2017-02-28 11:38:16] WARNING[1005][C-00000d21]: chan_sip.c:6057 create_addr: 
No such host: 832+ios:31oNPMLQ

[2017-02-28 11:38:16] WARNING[1005][C-00000d21]: app_dial.c:2437 
dial_exec_full: Unable to create channel of type 'SIP' (cause 20 - Subscriber 
absent)
-----

I've tried:
 - escaping the ! by prefixing it with a \
 - enclosing the entire password within '
 - enclosing the entire username / password within '
but Asterisk still simply stops reading at the ! and ignores everything which 
follows.

So, how can I get it to use this password which happens to contain a ! ?


2. If I get my remote provider to change the password so that it does not 
contain the ! symbol, Asterisk's behaviour changes:

exten => 
936,1,Dial(SIP/832+ios:31oNPMLQ_9d_XuQu at remote.server.com/0203xxxxyyy)

This now results in:

-----
    -- Executing [936 at outbound:1] Dial("SIP/1000-000000dc", 
"SIP/832+ios:31oNPMLQ_9d_XuQu at remote.server.com/0203xxxxyyy") in new stack

[2017-02-28 11:43:47] NOTICE[1011][C-00000d22]: chan_sip.c:29848 
sip_request_call: Conflicting extension values given. Using '832+ios' and not 
'0203xxxxyyy'

  == Using SIP RTP CoS mark 5

    -- Called SIP/832+ios:31oNPMLQ_9d_XuQu at remote.server.com/0203xxxxyyy

[2017-02-28 11:43:47] NOTICE[11692][C-00000d22]: chan_sip.c:23010 
handle_response_invite: Failed to authenticate on INVITE to '"Antony Stone" 
<sip:1000 at 4x.4x.1x.2x>;tag=as6ef135a8'
-----

So, I appear to have given the parameters in the correct form:

Dial(technology/user[:password]@remotehost[:port][/remote_extension])

and I get told that the username does not match the remote_extension (ie: the 
number I want to dial) - well, of course it doesn't - the username is part of 
my authentication to the server, nothing to do with who I want to call?


Incidentally, I do know I can put a Register statement into sip.conf, and then 
be able to use the Dial() application just using the username (and this 
works), however I need a solution which can support two or more accounts at 
different remote providers having the same username.

Therefore the username alone will not be unique, but the combination of 
username + password + server name will be, hence the reason why I would need 
to use this in the dialplan.


If anyone can offer suggestions on how to use the full SIP credentials in a 
Dial() statement, and also how to escape special characters such as ! I would 
be very grateful.


Thanks,


Antony.

-- 
Software development can be quick, high quality, or low cost.

The customer gets to pick any two out of three.

                                                   Please reply to the list;
                                                         please *don't* CC me.



More information about the asterisk-users mailing list