sdp_neg_test.c

来自「基于sip协议的网络电话源码」· C语言 代码 · 共 1,210 行 · 第 1/3 页

C
1,210
字号
	 * MPV video.  Note: Dynamic payload type 97 is used for iLBC codec	 */	"RFC 4317 section 2.1: Audio and Video 1 (Alice's view)",	1,	{	  {	    LOCAL_OFFER,	    /* Alice's local offer: */	    "v=0\r\n"	    "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n"	    "s=-\r\n"	    "c=IN IP4 host.atlanta.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49170 RTP/AVP 0 8 97\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "a=rtpmap:8 PCMA/8000\r\n"	    "a=rtpmap:97 iLBC/8000\r\n"	    "m=video 51372 RTP/AVP 31 32\r\n"	    "a=rtpmap:31 H261/90000\r\n"	    "a=rtpmap:32 MPV/90000\r\n",	    /* Received answer from Bob: */	    "v=0\r\n"	    "o=bob 2808844564 2808844564 IN IP4 host.biloxi.example.com\r\n"	    "s=-\r\n"	    "c=IN IP4 host.biloxi.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49174 RTP/AVP 0\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "m=video 49170 RTP/AVP 32\r\n"	    "a=rtpmap:32 MPV/90000\r\n",	    /* This is how Alice's media should look like now: */	    "v=0\r\n"	    "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n"	    "s=-\r\n"	    "c=IN IP4 host.atlanta.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49170 RTP/AVP 0\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "m=video 51372 RTP/AVP 32\r\n"	    "a=rtpmap:32 MPV/90000\r\n"	  }	}    },    /* test 5: */    {	/*********************************************************************	 * RFC 4317 Sample 2.1: Audio and Video 1 (Bob's view)	 *	 * This common scenario shows a video and audio session in which	 * multiple codecs are offered but only one is accepted.  As a result of	 * the exchange shown below, Alice and Bob may send only PCMU audio and	 * MPV video.  Note: Dynamic payload type 97 is used for iLBC codec	 *	 * Difference:	 *  - Bob's initial capability version number	 */	"RFC 4317 section 2.1: Audio and Video 1 (Bob's view)",	1,	{	  {	    REMOTE_OFFER,	    /* Received Alice's local offer: */	    "v=0\r\n"	    "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n"	    "s=-\r\n"	    "c=IN IP4 host.atlanta.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49170 RTP/AVP 0 8 97\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "a=rtpmap:8 PCMA/8000\r\n"	    "a=rtpmap:97 iLBC/8000\r\n"	    "m=video 51372 RTP/AVP 31 32\r\n"	    "a=rtpmap:31 H261/90000\r\n"	    "a=rtpmap:32 MPV/90000\r\n",	    /* Bob's capability: */	    "v=0\r\n"	    "o=bob 2808844564 2808844563 IN IP4 host.biloxi.example.com\r\n"	    "s=-\r\n"	    "c=IN IP4 host.biloxi.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49174 RTP/AVP 0\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "m=video 49170 RTP/AVP 32\r\n"	    "a=rtpmap:32 MPV/90000\r\n",	    /* This is how Bob's media should look like now: */	    "v=0\r\n"	    "o=bob 2808844564 2808844564 IN IP4 host.biloxi.example.com\r\n"	    "s=-\r\n"	    "c=IN IP4 host.biloxi.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49174 RTP/AVP 0\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "m=video 49170 RTP/AVP 32\r\n"	    "a=rtpmap:32 MPV/90000\r\n"	  }	}    },    /* test 6: */    {	/*********************************************************************	 * RFC 4317 Sample 2.2: Audio and Video 2 (Alice's view)	 *	 * Difference:	 *  - Bob's initial capability version number	 */	"RFC 4317 section 2.2: Audio and Video 2 (Alice's view)",	2,	{	  {	    LOCAL_OFFER,	    /* Alice sends offer: */	    "v=0\r\n"	    "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n"	    "s=alice\r\n"	    "c=IN IP4 host.atlanta.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49170 RTP/AVP 0 8 97\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "a=rtpmap:8 PCMA/8000\r\n"	    "a=rtpmap:97 iLBC/8000\r\n"	    "m=video 51372 RTP/AVP 31 32\r\n"	    "a=rtpmap:31 H261/90000\r\n"	    "a=rtpmap:32 MPV/90000\r\n",	    /* Bob's answer: */	    "v=0\r\n"	    "o=bob 2808844564 2808844564 IN IP4 host.biloxi.example.com\r\n"	    "s=bob\r\n"	    "c=IN IP4 host.biloxi.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49172 RTP/AVP 0 8\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "a=rtpmap:8 PCMA/8000\r\n"	    "m=video 0 RTP/AVP 31\r\n"	    "a=rtpmap:31 H261/90000\r\n",	    /* This is how Alice's media should look like now: */	    "v=0\r\n"	    "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n"	    "s=alice\r\n"	    "c=IN IP4 host.atlanta.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49170 RTP/AVP 0 8\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "a=rtpmap:8 PCMA/8000\r\n"	    "m=video 0 RTP/AVP 31\r\n"	    "a=rtpmap:31 H261/90000\r\n"	  },	  {	    LOCAL_OFFER,	    /* Alice sends updated offer: */	    "v=0\r\n"	    "o=alice 2890844526 2890844527 IN IP4 host.atlanta.example.com\r\n"	    "s=alice\r\n"	    "c=IN IP4 host.atlanta.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 51372 RTP/AVP 0\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "m=video 0 RTP/AVP 31\r\n"	    "a=rtpmap:31 H261/90000\r\n",	    /* Bob's answer: */	    "v=0\r\n"	    "o=bob 2808844564 2808844565 IN IP4 host.biloxi.example.com\r\n"	    "s=bob\r\n"	    "c=IN IP4 host.biloxi.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49172 RTP/AVP 0\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "m=video 0 RTP/AVP 31\r\n"	    "a=rtpmap:31 H261/90000\r\n",	    /* This is how Alice's SDP should look like: */	    "v=0\r\n"	    "o=alice 2890844526 2890844527 IN IP4 host.atlanta.example.com\r\n"	    "s=alice\r\n"	    "c=IN IP4 host.atlanta.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 51372 RTP/AVP 0\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "m=video 0 RTP/AVP 31\r\n"	    "a=rtpmap:31 H261/90000\r\n"	  }	}    },    /* test 7: */    {	/*********************************************************************	 * RFC 4317 Sample 2.2: Audio and Video 2 (Bob's view)	 *	 * Difference:	 *  - Bob's initial capability version number	 */	"RFC 4317 section 2.2: Audio and Video 2 (Bob's view)",	2,	{	  {	    REMOTE_OFFER,	    /* Received offer from alice: */	    "v=0\r\n"	    "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n"	    "s=alice\r\n"	    "c=IN IP4 host.atlanta.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49170 RTP/AVP 0 8 97\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "a=rtpmap:8 PCMA/8000\r\n"	    "a=rtpmap:97 iLBC/8000\r\n"	    "m=video 51372 RTP/AVP 31 32\r\n"	    "a=rtpmap:31 H261/90000\r\n"	    "a=rtpmap:32 MPV/90000\r\n",	    /* Bob's initial capability: */	    "v=0\r\n"	    "o=bob 2808844564 2808844563 IN IP4 host.biloxi.example.com\r\n"	    "s=bob\r\n"	    "c=IN IP4 host.biloxi.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49172 RTP/AVP 0 8\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "a=rtpmap:8 PCMA/8000\r\n"	    "m=video 0 RTP/AVP 31\r\n"	    "a=rtpmap:31 H261/90000\r\n",	    /* This is how Bob's answer should look like now: */	    "v=0\r\n"	    "o=bob 2808844564 2808844564 IN IP4 host.biloxi.example.com\r\n"	    "s=bob\r\n"	    "c=IN IP4 host.biloxi.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49172 RTP/AVP 0\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "m=video 0 RTP/AVP 31\r\n"	    "a=rtpmap:31 H261/90000\r\n"	  },	  {	    REMOTE_OFFER,	    /* Received updated offer from Alice: */	    "v=0\r\n"	    "o=alice 2890844526 2890844527 IN IP4 host.atlanta.example.com\r\n"	    "s=alice\r\n"	    "c=IN IP4 host.atlanta.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 51372 RTP/AVP 0\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "m=video 0 RTP/AVP 31\r\n"	    "a=rtpmap:31 H261/90000\r\n",	    /* Bob's answer: */	    NULL,	    /* This is how Bob's answer should look like: */	    "v=0\r\n"	    "o=bob 2808844564 2808844565 IN IP4 host.biloxi.example.com\r\n"	    "s=bob\r\n"	    "c=IN IP4 host.biloxi.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49172 RTP/AVP 0\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "m=video 0 RTP/AVP 31\r\n"	    "a=rtpmap:31 H261/90000\r\n"	  }	}    },    /* test 8: */    {	/*********************************************************************	 * RFC 4317 Sample 2.4: Audio and Telephone-Events (Alice's view)	 *	 */	"RFC 4317 section 2.4: Audio and Telephone-Events (Alice's view)",	1,	{	  {	    LOCAL_OFFER,	    /* Alice sends offer: */	    "v=0\r\n"	    "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n"	    "s=alice\r\n"	    "c=IN IP4 host.atlanta.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49170 RTP/AVP 0 97\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "a=rtpmap:97 iLBC/8000\r\n"	    "m=audio 49172 RTP/AVP 98\r\n"	    "a=rtpmap:98 telephone-event/8000\r\n"	    "a=sendonly\r\n",	    /* Received Bob's answer: */	    "v=0\r\n"	    "o=bob 2808844564 2808844564 IN IP4 host.biloxi.example.com\r\n"	    "s=bob\r\n"	    "c=IN IP4 host.biloxi.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49172 RTP/AVP 97\r\n"	    "a=rtpmap:97 iLBC/8000\r\n"	    "m=audio 49174 RTP/AVP 98\r\n"	    "a=rtpmap:98 telephone-event/8000\r\n"	    "a=recvonly\r\n",	    /* Alice's SDP now: */	    "v=0\r\n"	    "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n"	    "s=alice\r\n"	    "c=IN IP4 host.atlanta.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49170 RTP/AVP 97\r\n"	    "a=rtpmap:97 iLBC/8000\r\n"	    "m=audio 49172 RTP/AVP 98\r\n"	    "a=rtpmap:98 telephone-event/8000\r\n"	    "a=sendonly\r\n"	  }	}    },    /* test 9: */    {	/*********************************************************************	 * RFC 4317 Sample 2.4: Audio and Telephone-Events (Bob's view)	 *	 * Difference:	 *  - Bob's initial SDP version number	 *  - Bob's capability are added with more formats, and the	 *    stream order is interchanged to test the negotiator.	 */	"RFC 4317 section 2.4: Audio and Telephone-Events (Bob's view)",	1,	{	  {	    REMOTE_OFFER,	    /* Received Alice's offer: */	    "v=0\r\n"	    "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n"	    "s=alice\r\n"	    "c=IN IP4 host.atlanta.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49170 RTP/AVP 0 97\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "a=rtpmap:97 iLBC/8000\r\n"	    "m=audio 49172 RTP/AVP 98\r\n"	    "a=rtpmap:98 telephone-event/8000\r\n"	    "a=sendonly\r\n",	    /* Bob's initial capability: */	    "v=0\r\n"	    "o=bob 2808844564 2808844563 IN IP4 host.biloxi.example.com\r\n"	    "s=bob\r\n"	    "c=IN IP4 host.biloxi.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49174 RTP/AVP 4 98\r\n"	    "a=rtpmap:98 telephone-event/8000\r\n"	    "m=audio 49172 RTP/AVP 97 8 99\r\n"	    "a=rtpmap:97 iLBC/8000\r\n"	    "a=rtpmap:99 telephone-event/8000\r\n"	    "a=recvonly\r\n",	    /* Bob's answer should be: */	    "v=0\r\n"	    "o=bob 2808844564 2808844564 IN IP4 host.biloxi.example.com\r\n"	    "s=bob\r\n"	    "c=IN IP4 host.biloxi.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49172 RTP/AVP 97\r\n"	    "a=rtpmap:97 iLBC/8000\r\n"	    "m=audio 49174 RTP/AVP 98\r\n"	    "a=rtpmap:98 telephone-event/8000\r\n"	    "a=recvonly\r\n"	  }	}    },    /* test 10: */    {	/*********************************************************************	 * RFC 4317 Sample 2.6: Audio with Telephone-Events (Alice's view)	 *	 */	"RFC 4317 section 2.6: Audio with Telephone-Events (Alice's view)",	1,	{	  {	    LOCAL_OFFER,	    /* Alice sends offer: */	    "v=0\r\n"	    "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n"	    "s=alice\r\n"	    "c=IN IP4 host.atlanta.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 49170 RTP/AVP 0\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "m=audio 51372 RTP/AVP 97 101\r\n"	    "a=rtpmap:97 iLBC/8000\r\n"	    "a=rtpmap:101 telephone-event/8000\r\n",	    /* Received bob's answer: */	    "v=0\r\n"	    "o=bob 2808844564 2808844564 IN IP4 host.biloxi.example.com\r\n"	    "s=bob\r\n"	    "c=IN IP4 host.biloxi.example.com\r\n"	    "t=0 0\r\n"	    "m=audio 0 RTP/AVP 0\r\n"	    "a=rtpmap:0 PCMU/8000\r\n"	    "m=audio 49170 RTP/AVP 97 101\r\n"	    "a=rtpmap:97 iLBC/8000\r\n"	    "a=rtpmap:101 telephone-event/8000\r\n",	    /* Alice's local SDP should be: */	    "v=0\r\n"	    "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n"	    "s=alice\r\n"

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?