Sip trunk

Hi all,

First, i have mentioned different sip-id on username and authuser in sip.conf file in this case registration didn’t happened in either trunking & sip client also.

Second, if will be mentioned unique sip-id for both username and authuser only register.

I have tried to get answer from all sites and surfed in internet but didn’t get properly and everyone is using same sip-id for both things.

Could you please any one of us assist to clear this doubts and problems also?

Regards,
Kalyansundaram

The more I look at your question, less I know what you are trying to ask. Be more clear, give us examples from sip.conf and output from “sip set debug on”.

Sip.conf file on 10.10.1.42
[siptrunk]
username = sipu
secret = 1234
authuser = sipa
context = from-internal
host = dynamic
type = friend
qualify = yes

First scenario

Sip.conf file on 10.10.1.254

register => [peer?][transport://]user[@domain][:secret[]]@host[:port][/extension][~expiry]

I have done following steps for trunk.

[color=#0040FF]register => siptrunk:1234@10.10.1.42[/color]

Log message
connection established.

[Jul 11 11:04:46] NOTICE[1732]: chan_sip.c:13197 sip_reregister: – Re-registration for siptrunk@10.10.1.42
REGISTER 10 headers, 0 lines
Reliably Transmitting (NAT) to 10.10.1.42:5060:
REGISTER sip:10.10.1.42 SIP/2.0
Via: SIP/2.0/UDP 10.10.1.254:5060;branch=z9hG4bK56f588da;rport
Max-Forwards: 70
From: sip:siptrunk@10.10.1.42;tag=as14d931fd
To: sip:siptrunk@10.10.1.42
Call-ID: 0b9f316e482d87ad5a5789703128e94b@10.10.1.254
CSeq: 102 REGISTER
User-Agent: Asterisk PBX 1.8.16.0
Expires: 120
Contact: sip:s@10.10.1.254:5060
Content-Length: 0


<— SIP read from UDP:10.10.1.42:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.10.1.254:5060;branch=z9hG4bK56f588da;received=10.10.1.254;rport=5060
From: sip:siptrunk@10.10.1.42;tag=as14d931fd
To: sip:siptrunk@10.10.1.42;tag=as3fb1fb43
Call-ID: 0b9f316e482d87ad5a5789703128e94b@10.10.1.254
CSeq: 102 REGISTER
Server: Asterisk PBX 1.8.16.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="419f2b68"
Content-Length: 0

<------------->
— (11 headers 0 lines) —
Responding to challenge, registration to domain/host name 10.10.1.42
REGISTER 11 headers, 0 lines
Reliably Transmitting (NAT) to 10.10.1.42:5060:
REGISTER sip:10.10.1.42 SIP/2.0
Via: SIP/2.0/UDP 10.10.1.254:5060;branch=z9hG4bK3a3d46bc;rport
Max-Forwards: 70
From: sip:siptrunk@10.10.1.42;tag=as57ada5e5
To: sip:siptrunk@10.10.1.42
Call-ID: 0b9f316e482d87ad5a5789703128e94b@10.10.1.254
CSeq: 103 REGISTER
User-Agent: Asterisk PBX 1.8.16.0
Authorization: Digest username=“siptrunk”, realm=“asterisk”, algorithm=MD5, uri=“sip:10.10.1.42”, nonce=“419f2b68”, response="43a802bd37591a358518cac36115c42f"
Expires: 120
Contact: sip:s@10.10.1.254:5060
Content-Length: 0


<— SIP read from UDP:10.10.1.42:5060 —>
OPTIONS sip:s@10.10.1.254:5060 SIP/2.0
Via: SIP/2.0/UDP 10.10.1.42:5060;branch=z9hG4bK1376212c;rport
Max-Forwards: 70
From: “asterisk” sip:asterisk@10.10.1.42;tag=as7cc03cb1
To: sip:s@10.10.1.254:5060
Contact: sip:asterisk@10.10.1.42:5060
Call-ID: 3d2d2c2a1bd75a45629f02a87a419cc1@10.10.1.42:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 1.8.16.0
Date: Fri, 11 Jul 2014 05:44:40 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0

<------------->
— (13 headers 0 lines) —
Looking for s in default (domain 10.10.1.254)

<— Transmitting (NAT) to 10.10.1.42:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.10.1.42:5060;branch=z9hG4bK1376212c;received=10.10.1.42;rport=5060
From: “asterisk” sip:asterisk@10.10.1.42;tag=as7cc03cb1
To: sip:s@10.10.1.254:5060;tag=as1050ee3a
Call-ID: 3d2d2c2a1bd75a45629f02a87a419cc1@10.10.1.42:5060
CSeq: 102 OPTIONS
Server: Asterisk PBX 1.8.16.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Contact: sip:10.10.1.254:5060
Accept: application/sdp
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘3d2d2c2a1bd75a45629f02a87a419cc1@10.10.1.42:5060’ in 32000 ms (Method: OPTIONS)

<— SIP read from UDP:10.10.1.42:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.10.1.254:5060;branch=z9hG4bK3a3d46bc;received=10.10.1.254;rport=5060
From: sip:siptrunk@10.10.1.42;tag=as57ada5e5
To: sip:siptrunk@10.10.1.42;tag=as3fb1fb43
Call-ID: 0b9f316e482d87ad5a5789703128e94b@10.10.1.254
CSeq: 103 REGISTER
Server: Asterisk PBX 1.8.16.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Expires: 120
Contact: sip:s@10.10.1.254:5060;expires=120
Date: Fri, 11 Jul 2014 05:44:40 GMT
Content-Length: 0

<------------->
— (13 headers 0 lines) —
Scheduling destruction of SIP dialog ‘0b9f316e482d87ad5a5789703128e94b@10.10.1.254’ in 32000 ms (Method: REGISTER)
[Jul 11 11:04:46] NOTICE[1732]: chan_sip.c:20951 handle_response_register: Outbound Registration: Expiry for 10.10.1.42 is 120 sec (Scheduling reregistration in 105 s)
server*CLI>

2nd scenario

Now I’m going to trunk using with authuser

[color=#0040FF]register => siptrunk:1234:sipa@10.10.1.42[/color]

log for sip debug
[Jul 11 11:10:58] NOTICE[1732]: chan_sip.c:13197 sip_reregister: – Re-registration for siptrunk@10.10.1.42
REGISTER 10 headers, 0 lines
Reliably Transmitting (NAT) to 10.10.1.42:5060:
REGISTER sip:10.10.1.42 SIP/2.0
Via: SIP/2.0/UDP 10.10.1.254:5060;branch=z9hG4bK0dafa3db;rport
Max-Forwards: 70
From: sip:siptrunk@10.10.1.42;tag=as5f6f649b
To: sip:siptrunk@10.10.1.42
Call-ID: 2356bbb95064b4f75b1fe95b0d9da4be@10.10.1.254
CSeq: 102 REGISTER
User-Agent: Asterisk PBX 1.8.16.0
Expires: 120
Contact: sip:s@10.10.1.254:5060
Content-Length: 0


<— SIP read from UDP:10.10.1.42:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.10.1.254:5060;branch=z9hG4bK0dafa3db;received=10.10.1.254;rport=5060
From: sip:siptrunk@10.10.1.42;tag=as5f6f649b
To: sip:siptrunk@10.10.1.42;tag=as6e207722
Call-ID: 2356bbb95064b4f75b1fe95b0d9da4be@10.10.1.254
CSeq: 102 REGISTER
Server: Asterisk PBX 1.8.16.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="01659b31"
Content-Length: 0

<------------->
— (11 headers 0 lines) —
Responding to challenge, registration to domain/host name 10.10.1.42
REGISTER 11 headers, 0 lines
Reliably Transmitting (NAT) to 10.10.1.42:5060:
REGISTER sip:10.10.1.42 SIP/2.0
Via: SIP/2.0/UDP 10.10.1.254:5060;branch=z9hG4bK75f2b3bd;rport
Max-Forwards: 70
From: sip:siptrunk@10.10.1.42;tag=as52e9a027
To: sip:siptrunk@10.10.1.42
Call-ID: 2356bbb95064b4f75b1fe95b0d9da4be@10.10.1.254
CSeq: 103 REGISTER
User-Agent: Asterisk PBX 1.8.16.0
Authorization: Digest username=“sipa”, realm=“asterisk”, algorithm=MD5, uri=“sip:10.10.1.42”, nonce=“01659b31”, response="5e1b7382074fd30feba9c7b9704292ec"
xpires: 120
Contact: sip:s@10.10.1.254:5060
Content-Length: 0


<— SIP read from UDP:10.10.1.42:5060 —>
SIP/2.0 403 Forbidden (Bad auth)
Via: SIP/2.0/UDP 10.10.1.254:5060;branch=z9hG4bK75f2b3bd;received=10.10.1.254;rport=5060
From: sip:siptrunk@10.10.1.42;tag=as52e9a027
To: sip:siptrunk@10.10.1.42;tag=as6e207722
Call-ID: 2356bbb95064b4f75b1fe95b0d9da4be@10.10.1.254
CSeq: 103 REGISTER
Server: Asterisk PBX 1.8.16.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0

<------------->
— (10 headers 0 lines) —
[Jul 11 11:10:58] WARNING[1732]: chan_sip.c:20835 handle_response_register: Forbidden - wrong password on authentication for REGISTER for ‘siptrunk’ to '10.10.1.42’
Really destroying SIP dialog ‘2356bbb95064b4f75b1fe95b0d9da4be@10.10.1.254’ Method: REGISTER

<— SIP read from UDP:10.10.1.42:5060 —>
OPTIONS sip:s@10.10.1.254:5060 SIP/2.0
Via: SIP/2.0/UDP 10.10.1.42:5060;branch=z9hG4bK0c79f0e5;rport
Max-Forwards: 70
From: “asterisk” sip:asterisk@10.10.1.42;tag=as463a08a0
To: sip:s@10.10.1.254:5060
Contact: sip:asterisk@10.10.1.42:5060
Call-ID: 645eff3e789cca3d22b8e14b6c878ad3@10.10.1.42:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 1.8.16.0
Date: Fri, 11 Jul 2014 05:50:55 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0

<------------->
— (13 headers 0 lines) —
Looking for s in default (domain 10.10.1.254)

<— Transmitting (NAT) to 10.10.1.42:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.10.1.42:5060;branch=z9hG4bK0c79f0e5;received=10.10.1.42;rport=5060
From: “asterisk” sip:asterisk@10.10.1.42;tag=as463a08a0
To: sip:s@10.10.1.254:5060;tag=as3c6b83f7
Call-ID: 645eff3e789cca3d22b8e14b6c878ad3@10.10.1.42:5060
CSeq: 102 OPTIONS
Server: Asterisk PBX 1.8.16.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Contact: sip:10.10.1.254:5060
Accept: application/sdp
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘645eff3e789cca3d22b8e14b6c878ad3@10.10.1.42:5060’ in 32000 ms (Method: OPTIONS)
Really destroying SIP dialog ‘645eff3e789cca3d22b8e14b6c878ad3@10.10.1.42:5060’ Method: OPTIONS

Note :
Just wants to know what are difference between user, username, authuser, authname also and how can we use those thing in sip trunk,
could you please clear my doubts i have very confused about this, even i didn’t get clear points for these difference.
–Kalyanasundaram

Hello.

Some VoIP providers require username:password only. Others require authuser in addition.

As you’ve mentioned:

register => [peer?][transport://]user[@domain][:secret[]]@host[:port][/extension][~expiry]

So, try to register in this way:

register => sipu:1234:sipa@10.10.1.42/123456

[123456]
defaultuser = sipu
secret = 1234
context = from-internal
host = 10.10.1.42
type = peer
insecure = port,invite
qualify = yes

Try this out and write if it helped.

Thanks Mr, Lexus45

I’ve tried with yours.
Receiving this reports.

10.10.1.42 server
[color=#0080FF]Sip show peers[/color]
123456/sipu 10.10.1.42 N 5060 OK (1 ms)

10.10.1.254 server
[color=#0040FF]Sip reload [/color]
[Jul 11 12:30:03] WARNING[1732]: chan_sip.c:20835 handle_response_register: Forbidden - wrong password on authentication for REGISTER for ‘sipu’ to ‘10.10.1.42’

[color=#0040FF]Sip show registry[/color]
Host dnsmgr Username Refresh State Reg.Time
10.10.1.42:5060 N sipu 120 No Authentication

And may i know why i haven’t mentioned authuser in sip.conf and mentioned register syntax?

–kalyanasundaram

Are both servers your servers?
If you have access to both of them, you can set up a sip-trunk without registration. Generally speaking, registration is needed when one of hosts doesn’t have a static IP address.

If you have access to both servers, just create a trunk on each of them.

Something like:

on server A, 10.10.1.42:

[to-b] type=peer qualify=yes host=10.10.1.254 insecure=port,invite context=incoming

on server B, 10.10.1.254:

[to-a] type=peer qualify=yes host=10.10.1.42 insecure=port,invite context=incoming

Then do ‘sip reload’ on both and you’re done.
Everything else must be solved with the dialplan.

I agreed your point but we have being trunk with other pbx server. So that case, some of people has providing authuser… that’s why i’m asking.

even i can’t configure using authuser.

In some cases you need to configure something like:

register => sipu@ispdomain.net:1234:sipa@10.10.1.42/123456

Try several variants and ask that side about exact Asterisk settings for you.

Really Thanks Mr.

I will check it and reply you.