User Rating: 0 / 5

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 
sip-flow-elements.png

These days, VoIP is very complex. It is hard for some people to make a difference where some elements start their role and when others end it. This is the case of provisioning; provisioning is the fact of letting the SIP Endpoints to pull the needed information (SIP credentials, contacts, buttons actions and more).

Usually, an IP telephone tries to pull the information using a file storage protocol like FTP, TFTP or HTTP. HTTP (or HTTPS) is the most common. I will talk about it because FusionPBX supports it out of the box, however, you are free to use whatever you want. This call depends on your IP phone brand.

The following diagram shows the data flow.

sip flow messages

The endpoint will send an HTTP request using a specific URL. Some phones will do something like 0123456789af.xml (using the mac address in the GET URL) or a static request with a specific user agent string like Grandstream phones with a value of Grandstream Model HW GXP2135 SW 1.0.7.97 DevId 000b828aa872.

When the request arrives, the PHP scripts from the FusionPBX will pull data from the database. I am assuming there is no HTTP authentication in this article. The provisioning script will answer with a 200 error code and the correct payload. If you are using FusionPBX you can type a command like wget -O - 'http://domain/app/provisioning/index.php?mac=0123456789ab' to verify the payload.

The provisioning is done. From this point the SIP REGISTER event is in the normal SIP flow, regardless if you are using provisioning or not.

The IP phone will then send a REGISTER event. The first time, the payload will not have the proper registration information. The PBX will answer with a 401 error code.

69.135.215.50.13762 > 10.2.0.5.5060: SIP, length: 600
REGISTER sip:pbx.inside-out.xyz SIP/2.0
Via: SIP/2.0/UDP 192.168.168.178:2048;branch=z9hG4bK-leolsz0ee5oc;rport
From: "250" <sip:This email address is being protected from spambots. You need JavaScript enabled to view it.>;;tag=oykzjvrl8w
To: "250" <sip:This email address is being protected from spambots. You need JavaScript enabled to view it.>;
Call-ID: 386d43f9b3b4-ln5x8niwr98j
CSeq: 9970 REGISTER
Max-Forwards: 70
Contact: <sip:This email address is being protected from spambots. You need JavaScript enabled to view it.:2048;line=pmmg1fs9>;reg-id=1;q=1.0;+sip.instance="<urn:uuid:15e830b0-a521-4f42-8f36-000413336D5A>"
User-Agent: snomPA1/8.7.3.19
Allow-Events: dialog
X-Real-IP: 192.168.168.178
Supported: path, gruu
Expires: 120
Content-Length: 0

10.2.0.5.5060 > 69.135.215.50.13762: SIP, length: 680
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.168.178:2048;branch=z9hG4bK-leolsz0ee5oc;rport=13762;received=69.135.215.50
From: "250" <sip:This email address is being protected from spambots. You need JavaScript enabled to view it.>;;tag=oykzjvrl8w
To: "250" <sip:This email address is being protected from spambots. You need JavaScript enabled to view it.>;;tag=apQZ8Ua6j7pDm
Call-ID: 386d43f9b3b4-ln5x8niwr98j
CSeq: 9970 REGISTER
User-Agent: FreeSWITCH-mod_sofia/1.6.17~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
WWW-Authenticate: Digest realm="pbx.inside-out.xyz", nonce="1ec0d88d-9124-4e02-aea2-a5e8985670de", algorithm=MD5, qop="auth"
Content-Length: 0

The endpoint will send a second REGISTER event with the proper authentication information. The PBX will then query the database, confirm the authentication and send a 200 error code.

69.135.215.50.13762 > 10.2.0.5.5060: SIP, length: 864
REGISTER sip:pbx.inside-out.xyz SIP/2.0
Via: SIP/2.0/UDP 192.168.168.178:2048;branch=z9hG4bK-kn8tlt7te0dy;rport
From: "250" <sip:This email address is being protected from spambots. You need JavaScript enabled to view it.>;;tag=oykzjvrl8w
To: "250" <sip:This email address is being protected from spambots. You need JavaScript enabled to view it.>;
Call-ID: 386d43f9b3b4-ln5x8niwr98j
CSeq: 9971 REGISTER
Max-Forwards: 70
Contact: <sip:This email address is being protected from spambots. You need JavaScript enabled to view it.:2048;line=pmmg1fs9>;reg-id=1;q=1.0;+sip.instance="<urn:uuid:15e830b0-a521-4f42-8f36-000413336D5A>"
User-Agent: snomPA1/8.7.3.19
Allow-Events: dialog
X-Real-IP: 192.168.168.178
Supported: path, gruu
Authorization: Digest username="250",realm="pbx.inside-out.xyz",nonce="1ec0d88d-9124-4e02-aea2-a5e8985670de",uri="sip:pbx.inside-out.xyz",qop=auth,nc=00000001,cnonce="76fdae5a",response="d25c0dc5a76898da94ac74cd7e132cc7",algorithm=MD5
Expires: 120
Content-Length: 0

10.2.0.5.5060 > 69.135.215.50.13762: SIP, length: 634
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.168.178:2048;branch=z9hG4bK-kn8tlt7te0dy;rport=13762;received=69.135.215.50
From: "250" <sip:This email address is being protected from spambots. You need JavaScript enabled to view it.>;;tag=oykzjvrl8w
To: "250" <sip:This email address is being protected from spambots. You need JavaScript enabled to view it.>;;tag=c89gcjcDDS3jB
Call-ID: 386d43f9b3b4-ln5x8niwr98j
CSeq: 9971 REGISTER
Contact: <sip:This email address is being protected from spambots. You need JavaScript enabled to view it.:2048;line=pmmg1fs9>;expires=120
Date: Tue, 16 May 2017 03:16:26 GMT
User-Agent: FreeSWITCH-mod_sofia/1.6.17~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Content-Length: 0

Good luck!

blog comments powered by Disqus