[Asterisk-Users] Please help -- Syntax for dialing VoIP provider

BK [address only for mailing lists] bk_mailinglists at yahoo.co.uk
Sun Jul 6 04:16:19 MST 2003


Hi

thanks for your reply.

On Sunday, July 6, 2003, at 03:44 AM, John Todd wrote:

>> sip show registry gives me
>>
>> Host                 		Username    	Refresh	State
>> 63.214.186.6:5060	myusername	120		Registered
>>
>> sip debug also confirms successful registration.
>
> The command you will find more useful is "sip show peers".

show peers returns

Name/username    	Host			Mask		    Port   Status
Sip1/gsone		192.168.0.160	255.255.255.255 5060 Unmonitored
Sip2/gstwo		192.168.0.161	255.255.255.255 5060 Unmonitored
nikotel/myusername	63.214.186.6	255.255.255.255 5060 Unmonitored

I don't think the problem is with registration. As I said, sip debug 
confirms successful registration:

Sip read:
SIP/2.0 200 OK - 'Authenticated'
Via: SIP/2.0/UDP 192.168.0.111;branch=weoiuewotu
From: <sip:myusername at calamar0.nikotel.com>;tag=xznxzcvnxzvn
To: <sip:akabeni at calamar0.nikotel.com>
CSeq: 121 REGISTER
Call-ID: adslkfhalfhdlsahlsakghdasdfhasdfhasifh at 192.168.0.111
Expires: 120
Content-Length: 0
Contact: <sip:myusername at calamar0.nikotel.com:5060>


>  If your hosts are "(Unspecified)" then your SIP clients are not 
> registering, and inbound calls will not work if you are using 
> "dynamic=yes" in your sip.conf.  Possibly it may be helpful if you 
> would statically register your SIP phones until  you get things working 
> better ("host=10.3.2.3" in sip.conf)

I had already done that. Part of the problem seems to have been the 
length of the identifiers I had defined.

[Grandstream1]
username=grandstream1

appears to have been too long, so I shortened it to

[Sip1]
username=gsone

Now I can use the SIP phones internally at least. I can call from Sip1 
to Zap2 for example. Dialing into the PSTN from the Sip phones is still 
problematic, ie calls dropping, tiny volume etc etc.

However, for as long as I cannot even dial into Nikotel (nor FWD nor 
ICH) using one of the analog phones on (Zap2 or Zap3) I don't even fancy 
to fiddle with the SIP phones. The fever things there are in the call 
chain that could be responsible for it not working, the better, so for 
now, I want to concentrate on getting the dialing out via VoIP service 
provider working from the Zap lines.

>> I wonder what the syntax is to dial a number via a VoIP provider. This 
>> appears to be documented NOWHERE.
>
> I would disagree.  A VoIP provider is no different than a SIP phone; 
> they are treated the same.

If I dial into a SIP phone directly, I don't have to provide a third 
party number because the SIP phone is the destination already. If I dial 
into a VoIP service, I have to provide the number for my desired 
destination in addition to my own credentials. As a result the two cases 
are not the same as far as dialing syntax is concerned.

>   If you are looking for examples, please see 
> http://www.loligo.com/asterisk/   for my sample files, which contain 
> some VoIP provider dial statements.

Thanks, I had already been given the URL and I looked at it. One of the 
problems I had is that I find it difficult to work out what the *naked* 
dial string actually is because of all the macros and variables used in 
there.

I would prefer to start as barebones as it can possibly be and get the 
basics working. Bells and whistles can be added in later - one at a time.

>> exten => _00N.,1,Dial,SIP/${EXTEN:2}@calamar0.nikotel.com,tr
>> exten => _00N.,2,Congestion
>>
>> and sip debug tells me that the account doesn't match the one on 
>> record, whatever that means.
>>
>> I tried this:
>>
>> ; International long distance through VoIP service
>> ;
>> exten => _00N.,1,Dial,SIP/myusername at calamar0.nikotel.com/${EXTEN:2},tr
>
> You may be having at least one error due to syntax.  The line above 
> should look like:
>
> exten => 
> _00N.,1,Dial(SIP/myusername at calamar0.nikotel.com/${EXTEN:2},100,r)

Thanks for the hint. However, I am not quite so sure that this is the 
correct syntax either. When I try this with "sip debug" Asterisk does 
not even make an attempt to contact the remote VoIP service. It chokes 
on the dial string already and goes no further.

SIP Registration comes back with a SIP/2.0 200 OK (ie registration 
successful) for both ICH and Nikotel. Thus, I am confident that 
registration is not the issue. However dialing out (from Zap) with the 
various possibilities of syntax I could think of, simply doesn't work.

Here is what I have tried so far

in zapata.conf ...
-------------------------------------------------------------------------
signalling=fxo_ks
context=internal
channel => 2,3
-------------------------------------------------------------------------


in sip.conf ...
-------------------------------------------------------------------------
register => user:pass at calamar0.nikotel.com/asterisk ; already tried with 
user instead of asterisk and blank

[nikotel]                       ; Service Provider Nikotel
type=peer
secret=pass
username=user
host=calamar0.nikotel.com
-------------------------------------------------------------------------


in extensions.conf ...
-------------------------------------------------------------------------
[globals]
REDPHONE => Zap/3

[voipintl]
;
; International long distance through VoIP service
;
; Assuming Prefix Syntax without password
exten => _001N.,1,Dial(SIP/${EXTEN:3}/user at calamar0.nikotel.com,45,r)
;
; Assuming Prefix Syntax with password
exten => 
_002N.,1,Dial(SIP/${EXTEN:3}/user:pass at calamar0.nikotel.com,45,r)
;
; Assuming Postfix Syntax without password
exten => _003N.,1,Dial(SIP/user at calamar0.nikotel.com/${EXTEN:3},45,r)
;
; Assuming Postfix Syntax with password
exten => 
_004N.,1,Dial(SIP/user:pass at calamar0.nikotel.com/${EXTEN:3},45,r)
;
exten => _00[1234]N.,2,Congestion

;and further down

[international]
include => voipintl

[internal]
exten => 112,1,Dial(${REDPHONE},20,tr)	; phone on Zap/3
include = international
-------------------------------------------------------------------------


With this I tested all the four syntax test cases dialing out from 
REDPHONE (Zap/3) and with "sip debug".

In brief, none works, but at least the two prefix syntax tests show SIP 
activity, while the two postfix syntax tests do not show any SIP 
activity whatsoever, which leads me to believe that Asterisk doesn't 
even try to contact the remote SIP service provider when using the 
postfix syntax as you suggested.

I am happy to hunt down errors, but a situation where you spent three 15 
hour days trying while searching for documentation/hints and you STILL 
DON'T KNOW WHAT THE SYNTAX IS SUPPOSED TO BE is really very frustrating. 
I feel like I am stuck in a room with no windows and no light - in total 
darkness.

> You don't need the "t" unless you want the answering party to be able 
> to transfer your calls in your own system (probably bad) and you need 
> the "100" to tell the Dial statement how long to attempt the dial. If 
> you don't want to specify number of seconds, you'd need to leave that 
> area blank. (i.e.: ...TEN:2},,r)  )

thanks.

BTW, what is the difference between

Dial,SIP/abcabcabcabc		and		Dial(SIP/abcabcabcabc)  ?

>> Does anybody know how to dial a PSTN number through a VoIP service?
>>
>> Is this standardised, at least within SIP? Or does it vary from 
>> provider to provider?
>
> To the best of my experiences, it does not vary from provider to 
> provider.

Well, that gives me some comfort, but I must be doing something wrong, 
because I can't place any VoIP calls from Asterisk with neither Nikotel 
nor ICH. It works fabulously when I register the SIP phone directly with 
the service provider and not go through Asterisk, though.

thanks again
rgds
bk


PS: Below are my debug logs, just in case anybody can figure out what's 
wrong ...

NB: phone numbers, username, branch, tag and Call-ID etc etc have been 
edited to anonymise


1) POSTFIX test

     -- Starting simple switch on 'Zap/3-1'
     -- Executing Dial("Zap/3-1", 
"SIP/user at calamar0.nikotel.com/442071231234|45|r") in new stack
   == Everyone is busy at this time
     -- Executing Congestion("Zap/3-1", "") in new stack

No SIP activity whatsoever.

The message "Everyone is busy at this time" has been popping up before 
in other situations (ie on the Zaptel side) when there have been 
problems. It seems to be Asterisk catch-all message for any kind of 
trouble no matter what real problem is, so I don't trust this message at 
all. I think it's misleading here.


2) PREFIX test

(essentially the same results for both prefix test cases, whether with 
or without embedded password)

     -- Executing Dial("Zap/3-1", 
"SIP/442071231234/user at calamar0.nikotel.com|45|r") in new stack
We're at 192.168.0.111 port 15436
Answering with capability 2
Answering with capability 4
Answering with capability 8
Answering with non-codec capability 1
10 headers, 11 lines
Reliably Transmitting:
INVITE sip:442071231234/user at calamar0.nikotel.com SIP/2.0
Via: SIP/2.0/UDP 192.168.0.111:5060;branch=zczvbzmnvbnzxmn
From: "asterisk" <sip:asterisk at 192.168.0.111>;tag=asdfssdfsafasfsaf
To: <sip:442071231234/user at calamar0.nikotel.com>
Contact: <sip:asterisk at 192.168.0.111>
Call-ID: 3sakjgsafjsafgksajfgksajfgksajfgksajgakfsjg at 192.168.0.111
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Content-Type: application/sdp
Content-Length: 238

v=0
o=root 26052 26052 IN IP4 192.168.0.111
s=session
c=IN IP4 192.168.0.111
t=0 0
m=audio 15436 RTP/AVP 3 0 8 101
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
  (no NAT) to 63.214.186.6:5060
     -- Called 442071231234/user at calamar0.nikotel.com
Sip read:
SIP/2.0 100 Trying - 'Invite request is in progress'
Via: SIP/2.0/UDP 192.168.0.111;branch=zczvbzmnvbnzxmn
From: "asterisk" <sip:asterisk at 192.168.0.111>;tag=asdfssdfsafasfsaf
To: <sip:442071231234/user at calamar0.nikotel.com>
CSeq: 102 INVITE
Call-ID: 3sakjgsafjsafgksajfgksajfgksajfgksajgakfsjg2 at 192.168.0.111
Expires: 31
Content-Length: 0


8 headers, 0 lines
Sip read:
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 192.168.0.111;branch=zczvbzmnvbnzxmn
From: "asterisk" <sip:asterisk at 192.168.0.111>;tag=asdfssdfsafasfsaf
To: <sip:442071231234/user at calamar0.nikotel.com>
CSeq: 102 INVITE
Call-ID: 3sakjgsafjsafgksajfgksajfgksajfgksajgakfsjg at 192.168.0.111
Expires: 31
Proxy-Authenticate: Digest realm="nikotel.com", algorithm="MD5", 
nonce="x36434x343cf", qop="auth", opaque="f74e384684f368484e84d3684s"
Content-Length: 0


9 headers, 0 lines
Transmitting:
ACK sip:442071231234/user at calamar0.nikotel.com SIP/2.0
Via: SIP/2.0/UDP 192.168.0.111:5060;branch=zczvbzmnvbnzxmn
From: "asterisk" <sip:asterisk at 192.168.0.111>;tag=asdfssdfsafasfsaf
To: <sip:442079006430/akabeni at calamar0.nikotel.com>
Contact: <sip:asterisk at 192.168.0.111>
Call-ID: 3sakjgsafjsafgksajfgksajfgksajfgksajgakfsjg at 192.168.0.111
CSeq: 102 ACK
User-Agent: Asterisk PBX
Content-Length: 0

  (no NAT) to 63.214.186.6:5060
We're at 192.168.0.111 port 15436
Answering with capability 2
Answering with capability 4
Answering with capability 8
Answering with non-codec capability 1
Reliably Transmitting:
INVITE sip:442071231234/user at calamar0.nikotel.com SIP/2.0
Via: SIP/2.0/UDP 192.168.0.111:5060;branch=zczvbzmnvbnzxmn
From: "asterisk" <sip:asterisk at 192.168.0.111>;tag=asdfssdfsafasfsaf
To: <sip:442071231234/user at calamar0.nikotel.com>
Contact: <sip:asterisk at 192.168.0.111>
Call-ID: 3sakjgsafjsafgksajfgksajfgksajfgksajgakfsjg at 192.168.0.111
CSeq: 103 INVITE
User-Agent: Asterisk PBX
Proxy-Authorization: Digest username="442071231234/user", 
realm="nikotel.com", algorithm="MD5", 
uri="sip:442071231234/user at calamar0.nikotel.com", nonce="fx36434x343cf", 
response="598d7458f55e55f555
e5d5d5d5d5"
Content-Type: application/sdp
Content-Length: 238

v=0
o=root 16910 16910 IN IP4 192.168.0.111
s=session
c=IN IP4 192.168.0.111
t=0 0
m=audio 15436 RTP/AVP 3 0 8 101
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
  (no NAT) to 63.214.186.6:5060
Sip read:
SIP/2.0 100 Trying - 'Invite request is in progress'
Via: SIP/2.0/UDP 192.168.0.111;branch=zczvbzmnvbnzxmn
From: "asterisk" <sip:asterisk at 192.168.0.111>;tag=asdfssdfsafasfsaf
To: <sip:442071231234/user at calamar0.nikotel.com>
CSeq: 103 INVITE
Call-ID: 3sakjgsafjsafgksajfgksajfgksajfgksajgakfsjg at 192.168.0.111
Expires: 31
Content-Length: 0


8 headers, 0 lines
Sip read:
SIP/2.0 401 Unauthorized - 'Account username does not match address of 
record'
Via: SIP/2.0/UDP 192.168.0.111;branch=zczvbzmnvbnzxmn
From: "asterisk" <sip:asterisk at 192.168.0.111>;tag=asdfssdfsafasfsaf
To: <sip:442071231234/user at calamar0.nikotel.com>
CSeq: 103 INVITE
Call-ID: 3sakjgsafjsafgksajfgksajfgksajfgksajgakfsjg at 192.168.0.111
Expires: 31
Content-Length: 0


and so it goes on and on and on until I finally hang up ...

CLI> sip no debug
SIP Debugging Disabled
   == Spawn extension (internal, 001442071231234, 1) exited non-zero on 
'Zap/3-1'
     -- Hungup 'Zap/3-1'




More information about the asterisk-users mailing list