-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from rtckit/v0.6.0
v0.6.0
- Loading branch information
Showing
79 changed files
with
1,505 additions
and
531 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,27 +29,35 @@ $message = \RTCKit\SIP\Message::parse($text); | |
echo get_class($message) . PHP_EOL; | ||
|
||
/* Outputs something similar to: | ||
* Protocol version: SIP/2.0 | ||
* Request method: REGISTER | ||
* Request URI: sip:192.168.0.1 | ||
* Via: 192.168.0.2:5050 | ||
* Via branch: z9hG4bK.eAV4o0nXr | ||
* From: sip:[email protected] | ||
* From tag: SFJbQ2oWh | ||
* To: sip:[email protected] | ||
* Sequence number: 20 | ||
* Call ID: ob0EYyuyC0 | ||
* Protocol version: SIP/2.0 | ||
* Request method: REGISTER | ||
* Request URI: sip:192.168.0.1 | ||
* Via: 192.168.0.2:5050 | ||
* Via branch: z9hG4bK.eAV4o0nXr | ||
* From scheme: sip | ||
* From user: buzz | ||
* From host: 192.168.0.1 | ||
* From tag: SFJbQ2oWh | ||
* To scheme: sip | ||
* To user: buzz | ||
* To host: 192.168.0.1 | ||
* Sequence number: 20 | ||
* Call ID: ob0EYyuyC0 | ||
*/ | ||
printf("Protocol version: %s" . PHP_EOL, $message->version); | ||
printf("Request method: %s" . PHP_EOL, $message->method); | ||
printf("Request URI: %s" . PHP_EOL, $message->uri); | ||
printf("Via: %s" . PHP_EOL, $message->via->values[0]->host); | ||
printf("Via branch: %s" . PHP_EOL, $message->via->values[0]->branch); | ||
printf("From: %s" . PHP_EOL, $message->from->addr); | ||
printf("From tag: %s" . PHP_EOL, $message->from->tag); | ||
printf("To: %s" . PHP_EOL, $message->to->addr); | ||
printf("Sequence number: %s" . PHP_EOL, $message->cSeq->sequence); | ||
printf("Call ID: %s" . PHP_EOL, $message->callId->value); | ||
printf("Protocol version: %s" . PHP_EOL, $message->version); | ||
printf("Request method: %s" . PHP_EOL, $message->method); | ||
printf("Request URI: %s" . PHP_EOL, $message->uri); | ||
printf("Via: %s" . PHP_EOL, $message->via->values[0]->host); | ||
printf("Via branch: %s" . PHP_EOL, $message->via->values[0]->branch); | ||
printf("From scheme: %s" . PHP_EOL, $request->from->uri->scheme); | ||
printf("From user: %s" . PHP_EOL, $request->from->uri->user); | ||
printf("From host: %s" . PHP_EOL, $request->from->uri->host); | ||
printf("From tag: %s" . PHP_EOL, $request->from->tag); | ||
printf("To scheme: %s" . PHP_EOL, $request->to->uri->scheme); | ||
printf("To user: %s" . PHP_EOL, $request->to->uri->user); | ||
printf("To host: %s" . PHP_EOL, $request->to->uri->host); | ||
printf("Sequence number: %s" . PHP_EOL, $message->cSeq->sequence); | ||
printf("Call ID: %s" . PHP_EOL, $message->callId->value); | ||
``` | ||
|
||
#### SIP Message Rendering | ||
|
@@ -70,11 +78,17 @@ $response->via->values[0]->host = '192.168.0.2:5050'; | |
$response->via->values[0]->branch = 'z9hG4bK.eAV4o0nXr'; | ||
|
||
$response->from = new \RTCKit\SIP\Header\NameAddrHeader; | ||
$response->from->addr = 'sip:[email protected]'; | ||
$response->from->uri = new \RTCKit\SIP\URI; | ||
$response->from->uri->scheme = 'sip'; | ||
$response->from->uri->user = 'buzz'; | ||
$response->from->uri->host = '192.168.0.1'; | ||
$response->from->tag = 'SFJbQ2oWh'; | ||
|
||
$response->to = new \RTCKit\SIP\Header\NameAddrHeader; | ||
$response->to->addr = 'sip:[email protected]'; | ||
$response->to->uri = new \RTCKit\SIP\URI; | ||
$response->to->uri->scheme = 'sip'; | ||
$response->to->uri->user = 'buzz'; | ||
$response->to->uri->host = '192.168.0.1'; | ||
$response->to->tag = '8cQtUyH6N5N9K'; | ||
|
||
$response->cSeq = new \RTCKit\SIP\Header\CSeqHeader; | ||
|
@@ -89,7 +103,12 @@ $response->maxForwards->value = 70; | |
|
||
$response->contact = new \RTCKit\SIP\Header\ContactHeader; | ||
$response->contact->values[0] = new \RTCKit\SIP\Header\ContactValue; | ||
$response->contact->values[0]->addr = 'sip:[email protected]:5050;transport=udp'; | ||
$response->contact->values[0]->uri = new \RTCKit\SIP\URI; | ||
$response->contact->values[0]->uri->scheme = 'sip'; | ||
$response->contact->values[0]->uri->user = 'buzz'; | ||
$response->contact->values[0]->uri->host = '192.168.0.2'; | ||
$response->contact->values[0]->uri->port = 5050; | ||
$response->contact->values[0]->uri->transport = 'udp'; | ||
$response->contact->values[0]->expires = 3600; | ||
|
||
$response->userAgent = new \RTCKit\SIP\Header\Header; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,30 +25,35 @@ | |
'Accept: text/plain' . "\r\n" . | ||
'Accept: application/vnd.gsma.rcs-ft-http+xml' . "\r\n" . | ||
'Contact: <sip:[email protected]:5050;transport=udp>' . "\r\n" . | ||
' ;q=0.7; expires=3600' . "\r\n" . | ||
' ;+sip.instance="<urn:uuid:5cc54b96-ab90-4652-b4e5-de74c8e56fb7>"' . "\r\n" . | ||
'Contact: <sip:[email protected];transport=tcp>;reg-id=1;expires=3600' . "\r\n" . | ||
' ;+sip.instance="<urn:uuid:00000000-0000-1000-8000-AABBCCDDEEFF>"' . "\r\n" . | ||
'Contact: <sip:[email protected];transport=tcp>;reg-id=2;expires=3600' . "\r\n" . | ||
' ;+sip.instance="<urn:uuid:00000000-0000-1000-8000-AABBCCDDEEFF>"' . "\r\n" . | ||
' ;q=0.7; expires=3600' . "\r\n" . | ||
' ;+sip.instance="<urn:uuid:5cc54b96-ab90-4652-b4e5-de74c8e56fb7>"' . "\r\n" . | ||
'Contact: <sip:[email protected];transport=tcp>;reg-id=1;expires=3600' . "\r\n" . | ||
' ;+sip.instance="<urn:uuid:00000000-0000-1000-8000-AABBCCDDEEFF>"' . "\r\n" . | ||
'Contact: <sip:[email protected];transport=tcp>;reg-id=2;expires=3600' . "\r\n" . | ||
' ;+sip.instance="<urn:uuid:00000000-0000-1000-8000-AABBCCDDEEFF>"' . "\r\n" . | ||
'Expires: 3600' . "\r\n" . | ||
'User-Agent: MyDeskPhone/1.0.0' . "\r\n" . | ||
"\r\n"; | ||
|
||
$request = Message::parse($text); | ||
|
||
printf("Message type: %s" . PHP_EOL, (get_class($request) === Request::class) ? 'SIP Request' : 'BOGUS!!!'); | ||
printf("Protocol version: %s" . PHP_EOL, $request->version); | ||
printf("Request method: %s" . PHP_EOL, $request->method); | ||
printf("Request URI: %s" . PHP_EOL, $request->uri); | ||
printf("Via: %s" . PHP_EOL, $request->via->values[0]->host); | ||
printf("Via branch: %s" . PHP_EOL, $request->via->values[0]->branch); | ||
printf("From: %s" . PHP_EOL, $request->from->addr); | ||
printf("From tag: %s" . PHP_EOL, $request->from->tag); | ||
printf("To: %s" . PHP_EOL, $request->to->addr); | ||
printf("CSeq: %s" . PHP_EOL, $request->cSeq->sequence); | ||
printf("Call ID: %s" . PHP_EOL, $request->callId->value); | ||
printf("Max forwards: %d" . PHP_EOL, $request->maxForwards->value); | ||
printf("Message type: %s" . PHP_EOL, (get_class($request) === Request::class) ? 'SIP Request' : 'BOGUS!!!'); | ||
printf("Protocol version: %s" . PHP_EOL, $request->version); | ||
printf("Request method: %s" . PHP_EOL, $request->method); | ||
printf("Request URI scheme: %s" . PHP_EOL, $request->uri->scheme); | ||
printf("Request URI host: %s" . PHP_EOL, $request->uri->host); | ||
printf("Via: %s" . PHP_EOL, $request->via->values[0]->host); | ||
printf("Via branch: %s" . PHP_EOL, $request->via->values[0]->branch); | ||
printf("From scheme: %s" . PHP_EOL, $request->from->uri->scheme); | ||
printf("From user: %s" . PHP_EOL, $request->from->uri->user); | ||
printf("From host: %s" . PHP_EOL, $request->from->uri->host); | ||
printf("From tag: %s" . PHP_EOL, $request->from->tag); | ||
printf("To scheme: %s" . PHP_EOL, $request->to->uri->scheme); | ||
printf("To user: %s" . PHP_EOL, $request->to->uri->user); | ||
printf("To host: %s" . PHP_EOL, $request->to->uri->host); | ||
printf("CSeq: %s" . PHP_EOL, $request->cSeq->sequence); | ||
printf("Call ID: %s" . PHP_EOL, $request->callId->value); | ||
printf("Max forwards: %d" . PHP_EOL, $request->maxForwards->value); | ||
|
||
printf("Supported: "); | ||
|
||
|
@@ -70,8 +75,10 @@ | |
printf("- %s" . PHP_EOL, $val->value); | ||
} | ||
|
||
|
||
printf("Contact: %s" . PHP_EOL, $request->contact->values[0]->addr); | ||
printf("Contact scheme: %s" . PHP_EOL, $request->contact->values[0]->uri->scheme); | ||
printf("Contact user: %s" . PHP_EOL, $request->contact->values[0]->uri->user); | ||
printf("Contact host: %s" . PHP_EOL, $request->contact->values[0]->uri->host); | ||
printf("Contact transport: %s" . PHP_EOL, $request->contact->values[0]->uri->transport); | ||
printf("Contact q-value: %s" . PHP_EOL, $request->contact->values[0]->q); | ||
printf("Contact expires: %s" . PHP_EOL, $request->contact->values[0]->expires); | ||
printf("Contact instance: %s" . PHP_EOL, $request->contact->values[0]->params['+sip.instance']); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,11 +18,14 @@ | |
use RTCKit\SIP\Header\ViaHeader; | ||
use RTCKit\SIP\Header\ViaValue; | ||
use RTCKit\SIP\Request; | ||
use RTCKit\SIP\URI; | ||
|
||
$request = new Request; | ||
$request->version = 'SIP/2.0'; | ||
$request->method = 'REGISTER'; | ||
$request->uri = 'sip:192.168.0.1'; | ||
$request->uri = new URI; | ||
$request->uri->scheme = 'sip'; | ||
$request->uri->host = '192.168.0.1'; | ||
|
||
$request->via = new ViaHeader; | ||
$request->via->values[0] = new ViaValue; | ||
|
@@ -33,11 +36,17 @@ | |
$request->via->values[0]->branch = 'z9hG4bK.eAV4o0nXr'; | ||
|
||
$request->from = new NameAddrHeader; | ||
$request->from->addr = 'sip:[email protected]'; | ||
$request->from->uri = new URI; | ||
$request->from->uri->scheme = 'sip'; | ||
$request->from->uri->user = 'buzz'; | ||
$request->from->uri->host = '192.168.0.1'; | ||
$request->from->tag = 'SFJbQ2oWh'; | ||
|
||
$request->to = new NameAddrHeader; | ||
$request->to->addr = 'sip:[email protected]'; | ||
$request->to->uri = new URI; | ||
$request->to->uri->scheme = 'sip'; | ||
$request->to->uri->user = 'buzz'; | ||
$request->to->uri->host = '192.168.0.1'; | ||
|
||
$request->cSeq = new CSeqHeader; | ||
$request->cSeq->sequence = 20; | ||
|
@@ -51,7 +60,12 @@ | |
|
||
$request->contact = new ContactHeader; | ||
$request->contact->values[0] = new ContactValue; | ||
$request->contact->values[0]->addr = 'sip:[email protected]:5050;transport=udp'; | ||
$request->contact->values[0]->uri = new URI; | ||
$request->contact->values[0]->uri->scheme = 'sip'; | ||
$request->contact->values[0]->uri->user = 'buzz'; | ||
$request->contact->values[0]->uri->host = '192.168.0.2'; | ||
$request->contact->values[0]->uri->port = 5050; | ||
$request->contact->values[0]->uri->transport = 'udp'; | ||
$request->contact->values[0]->q = 0.7; | ||
$request->contact->values[0]->expires = 3600; | ||
$request->contact->values[0]->params['+sip.instance'] = '"<urn:uuid:5cc54b96-ab90-4652-b4e5-de74c8e56fb7>"'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
use RTCKit\SIP\Header\ViaHeader; | ||
use RTCKit\SIP\Header\ViaValue; | ||
use RTCKit\SIP\Response; | ||
use RTCKit\SIP\URI; | ||
|
||
$response = new Response; | ||
$response->version = 'SIP/2.0'; | ||
|
@@ -32,11 +33,17 @@ | |
$response->via->values[0]->branch = 'z9hG4bK.eAV4o0nXr'; | ||
|
||
$response->from = new NameAddrHeader; | ||
$response->from->addr = 'sip:[email protected]'; | ||
$response->from->uri = new URI; | ||
$response->from->uri->scheme = 'sip'; | ||
$response->from->uri->user = 'buzz'; | ||
$response->from->uri->host = '192.168.0.1'; | ||
$response->from->tag = 'SFJbQ2oWh'; | ||
|
||
$response->to = new NameAddrHeader; | ||
$response->to->addr = 'sip:[email protected]'; | ||
$response->to->uri = new URI; | ||
$response->to->uri->scheme = 'sip'; | ||
$response->to->uri->user = 'buzz'; | ||
$response->to->uri->host = '192.168.0.1'; | ||
$response->to->tag = '8cQtUyH6N5N9K'; | ||
|
||
$response->cSeq = new CSeqHeader; | ||
|
@@ -51,7 +58,12 @@ | |
|
||
$response->contact = new ContactHeader; | ||
$response->contact->values[0] = new ContactValue; | ||
$response->contact->values[0]->addr = 'sip:[email protected]:5050;transport=udp'; | ||
$response->contact->values[0]->uri = new URI; | ||
$response->contact->values[0]->uri->scheme = 'sip'; | ||
$response->contact->values[0]->uri->user = 'buzz'; | ||
$response->contact->values[0]->uri->host = '192.168.0.2'; | ||
$response->contact->values[0]->uri->port = 5050; | ||
$response->contact->values[0]->uri->transport = 'udp'; | ||
$response->contact->values[0]->q = 0.7; | ||
$response->contact->values[0]->expires = 3600; | ||
$response->contact->values[0]->params['+sip.instance'] = '"<urn:uuid:5cc54b96-ab90-4652-b4e5-de74c8e56fb7>"'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.