Click here to Skip to main content
15,896,455 members
Articles / Programming Languages / Visual C++ 10.0

SIP Stack (1 of 3)

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
20 Aug 2012CPOL3 min read 30.1K   1.7K   4  
SIP Stack Implementation on the basis of RFC SIP 3261 Specification
#BEGIN
CANCEL sip:192.168.1.2 SIP/2.0
Via: SIP/2.0/UDP 172.21.10.144;branch=z9hG4bKac150a900000010d4d2fdd330000199e00000002;rport
From: "unknown" <sip:172.21.10.144>;tag=687a4d52a8bd
To: <sip:192.168.1.2>
Call-ID: BBE579A97D0C46A293266D05B528ACD00xac150a90
CSeq: 1 CANCEL
Max-Forwards: 70
User-Agent: SJphone/1.65.377a (SJ Labs)
Content-Length: 0

hatim

#END$
#BEGIN
SIP/2.0 200 OK
Via: SIP/2.0/UDP bigbox3.site3.atlanta.com;branch=z9hG4bK77ef4c2312983.1;received=192.0.2.2
Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKnashds8;received=192.0.2.1
To: Bob <sip:bob@biloxi.com>;tag=a6c85cf
From: Alice <sip:alice@atlanta.com>;tag=1928301774
Call-ID: a84b4c76e66710
CSeq: 314159 INVITE
Contact: <sip:bob@192.0.2.4>
Content-Type: application/sdp
Content-Length: 131

a v h 
a b c

#END$
#BEGIN
INVITE sip:192.168.1.2 SIP/2.0
Via: SIP/2.0/UDP 172.21.10.144;branch=z9hG4bKac150a900000001a4d3434b6000079ea00000000;rport
From: "unknown" <sip:172.21.10.144>;tag=5cd45e488344
To: <sip:192.168.1.2>
Contact: <sip:172.21.10.144>
Call-ID: 9BD8CD3BC7BB4876B8A3ADFFAD03569A0xac150a90
CSeq: 1 INVITE
Max-Forwards: 70
User-Agent: SJphone/1.65.377a (SJ Labs)
Content-Length: 368
Content-Type: application/sdp
Supported: replaces,norefersub,timer

v=0
o=- 3504255798 3504255798 IN IP4 172.21.10.144
s=SJphone
c=IN IP4 172.21.10.144
t=0 0
m=audio 49152 RTP/AVP 3 97 98 8 0 101
c=IN IP4 172.21.10.144
a=rtpmap:3 GSM/8000
a=rtpmap:97 iLBC/8000
a=rtpmap:98 iLBC/8000
a=fmtp:98 mode=20
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=setup:active
a=sendrecv

#END$
#BEGIN
INVITE sip:3101@192.168.56.1 SIP/2.0
Via: SIP/2.0/UDP 192.168.56.1:28858;branch=z9hG4bK-d8754z-0fdd951806cd4762-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:7000@192.168.56.1:28858>
To: <sip:3101@192.168.56.1>
From: "7000"<sip:7000@182.168.1.177>;tag=29dba4f0
Call-ID: NmFmOWRiYzA3ODY0NmE0MmRhOTM0ZTg1YWE1MDEyMDQ.
CSeq: 1 INVITE
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
Content-Type: application/sdp
Supported: replaces
User-Agent: X-Lite 4 release 4.1 stamp 63214
Content-Length: 410

v=0
o=- 12984212154343685 1 IN IP4 182.168.1.177
s=CounterPath X-Lite 4.1
c=IN IP4 182.168.1.177
t=0 0
a=ice-ufrag:9c047c
a=ice-pwd:e2738cc806342eec10a66f9fef483dcc
m=audio 62398 RTP/AVP 107 0 8 101
a=rtpmap:107 BV32/16000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=candidate:1 1 UDP 659136 182.168.1.177 62398 typ host
a=candidate:1 2 UDP 659134 182.168.1.177 62399 typ host

#END$
#BEGIN
REGISTER sip:182.168.1.160 SIP/2.0
Via: SIP/2.0/UDP 182.168.1.177:15440;branch=z9hG4bK-d8754z-5e9424f72e4b4e1c-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:7000@182.168.1.177:15440;rinstance=58f4c616c713dfbe>
To: "7000"<sip:7000@182.168.1.160>
From: "7000"<sip:7000@182.168.1.160>;tag=6623053d
Call-ID: NTYyYzYyMDAyY2VkYjA4MmQ5NTA2N2QyYTk1NmJhYTY.
CSeq: 1 REGISTER
Expires: 3600
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
User-Agent: X-Lite 4 release 4.1 stamp 63214
Content-Length: 0

#END$
#BEGIN
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 182.168.1.177:15440;branch=z9hG4bK-d8754z-5e9424f72e4b4e1c-1---d8754z-;received=182.168.1.177;rport=15440
From: "7000"<sip:7000@182.168.1.160>;tag=6623053d
To: "7000"<sip:7000@182.168.1.160>;tag=as0ff006a0
Call-ID: NTYyYzYyMDAyY2VkYjA4MmQ5NTA2N2QyYTk1NmJhYTY.
CSeq: 1 REGISTER
Server: Asterisk PBX 1.8.11-cert1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="01c90dcc"
Content-Length: 0

#END$
#BEGIN
REGISTER sip:182.168.1.160 SIP/2.0
Via: SIP/2.0/UDP 182.168.1.177:15440;branch=z9hG4bK-d8754z-2a2f65990de84256-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:7000@182.168.1.177:15440;rinstance=58f4c616c713dfbe>
To: "7000"<sip:7000@182.168.1.160>
From: "7000"<sip:7000@182.168.1.160>;tag=6623053d
Call-ID: NTYyYzYyMDAyY2VkYjA4MmQ5NTA2N2QyYTk1NmJhYTY.
CSeq: 2 REGISTER
Expires: 3600
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
User-Agent: X-Lite 4 release 4.1 stamp 63214
Authorization: Digest username="7000",realm="asterisk",nonce="01c90dcc",uri="sip:182.168.1.160",response="6be6d39582e2f313dac03f765488ce99",algorithm=MD5
Content-Length: 0

#END$
#BEGIN
SIP/2.0 200 OK
Via: SIP/2.0/UDP 182.168.1.177:15440;branch=z9hG4bK-d8754z-2a2f65990de84256-1---d8754z-;received=182.168.1.177;rport=15440
From: "7000"<sip:7000@182.168.1.160>;tag=6623053d
To: "7000"<sip:7000@182.168.1.160>;tag=as0ff006a0
Call-ID: NTYyYzYyMDAyY2VkYjA4MmQ5NTA2N2QyYTk1NmJhYTY.
CSeq: 2 REGISTER
Server: Asterisk PBX 1.8.11-cert1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Expires: 3600
Contact: <sip:7000@182.168.1.177:15440;rinstance=58f4c616c713dfbe>;expires=3600
Date: Wed, 13 Jun 2012 07:38:13 GMT
Content-Length: 0

#END$
#BEGIN
INVITE sip:8000@182.168.1.160 SIP/2.0
Via: SIP/2.0/UDP 182.168.1.177:7292;branch=z9hG4bK-d8754z-7ab65b62619df43d-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:7000@182.168.1.177:7292>
To: <sip:8000@182.168.1.160>
From: "7000"<sip:7000@182.168.1.160>;tag=fa3f2070
Call-ID: Y2E0MjlhNTg4NDRhOGRiMjVlODVlOWM1ZTY1Njk4ZDk.
CSeq: 1 INVITE
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
Content-Type: application/sdp
Supported: replaces
User-Agent: X-Lite 4 release 4.1 stamp 63214
Content-Length: 410

v=0
o=- 12984488753457975 1 IN IP4 182.168.1.177
s=CounterPath X-Lite 4.1
c=IN IP4 182.168.1.177
t=0 0
a=ice-ufrag:26bed8
a=ice-pwd:ed1c9ddd31054923e4bc1337f1dfe411
m=audio 60608 RTP/AVP 107 0 8 101
a=rtpmap:107 BV32/16000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=candidate:1 1 UDP 659136 182.168.1.177 60608 typ host
a=candidate:1 2 UDP 659134 182.168.1.177 60609 typ host

#END$
#BEGIN
INVITE sip:8000@182.168.1.160 SIP/2.0
Via: SIP/2.0/UDP 182.168.1.177:7292;branch=z9hG4bK-d8754z-7ab65b62619df43d-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:7000@182.168.1.177:7292>
To: <sip:8000@182.168.1.160>
From: "7000"<sip:7000@182.168.1.160>;tag=fa3f2070
Call-ID: Y2E0MjlhNTg4NDRhOGRiMjVlODVlOWM1ZTY1Njk4ZDk.
CSeq: 1 INVITE
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
Content-Type: application/sdp
Supported: replaces
User-Agent: X-Lite 4 release 4.1 stamp 63214
Content-Length: 410

v=0
o=- 12984488753457975 1 IN IP4 182.168.1.177
s=CounterPath X-Lite 4.1
c=IN IP4 182.168.1.177
t=0 0
a=ice-ufrag:26bed8
a=ice-pwd:ed1c9ddd31054923e4bc1337f1dfe411
m=audio 60608 RTP/AVP 107 0 8 101
a=rtpmap:107 BV32/16000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=candidate:1 1 UDP 659136 182.168.1.177 60608 typ host
a=candidate:1 2 UDP 659134 182.168.1.177 60609 typ host

#END$
#BEGIN
INVITE sip:8000@182.168.1.160 SIP/2.0
Via: SIP/2.0/UDP 182.168.1.177:7292;branch=z9hG4bK-d8754z-7ab65b62619df43d-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:7000@182.168.1.177:7292>
To: <sip:8000@182.168.1.160>
From: "7000"<sip:7000@182.168.1.160>;tag=fa3f2070
Call-ID: Y2E0MjlhNTg4NDRhOGRiMjVlODVlOWM1ZTY1Njk4ZDk.
CSeq: 1 INVITE
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
Content-Type: application/sdp
Supported: replaces
User-Agent: X-Lite 4 release 4.1 stamp 63214
Content-Length: 410

v=0
o=- 12984488753457975 1 IN IP4 182.168.1.177
s=CounterPath X-Lite 4.1
c=IN IP4 182.168.1.177
t=0 0
a=ice-ufrag:26bed8
a=ice-pwd:ed1c9ddd31054923e4bc1337f1dfe411
m=audio 60608 RTP/AVP 107 0 8 101
a=rtpmap:107 BV32/16000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=candidate:1 1 UDP 659136 182.168.1.177 60608 typ host
a=candidate:1 2 UDP 659134 182.168.1.177 60609 typ host

#END$
#BEGIN
REGISTER sip:182.168.1.160 SIP/2.0
Via: SIP/2.0/UDP 182.168.1.177:5060;branch=z9hG4bK-ed82fcbb-3223-47ad-afa3-e2ead4ed0460; rport
Max-Forwards: 70
Contact: <sip:hatim@182.168.1.177:5060>
To: "hatim"<sip:hatim@182.168.1.160:5060>
From: "hatim"<sip:hatim@182.168.1.160:5060>;tag=56e44dfb
Call-ID: 4433f8c4-c27e-4447-9d88-004086939c13
CSeq: 1 REGISTER
Expires: 3600
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
User-Agent: MySIPClient
Content-Length: 0

#END$
#BEGIN
REGISTER sip:182.168.1.160 SIP/2.0
Via: SIP/2.0/UDP 182.168.1.177:5060;branch=z9hG4bK-d8754z-dd7256a17985956c-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:7000@182.168.1.177:5060;rinstance=3d0b101e9ac10900>
To: "7000"<sip:7000@182.168.1.160>
From: "7000"<sip:7000@182.168.1.160>;tag=a5e6b42e
Call-ID: NjNkYzM4ZTVkNzBlZDZkYmM2N2NiMjUyNTM4ZTJmYTA.
CSeq: 1 REGISTER
Expires: 3600
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
User-Agent: X-Lite 4 release 4.1 stamp 63214
Content-Length: 0

#END$
#BEGIN

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
India India
Hatim Haidry

VC++, Technical Architect

India

haidryhatim@gmail.com

Comments and Discussions