文档

可以查看exosip osip的在线文档

http://www.antisip.com/doc/

在线文档 一般先看mainpage 会有库的一个整体说明。

其次看看 modules 会有一些使用说明。

exosip是对osip的封装 使用osip简单好用。 osip主要包括sip sdp 协议的解析  fmt 无限状态机 实现sip协议的会话状态(这个没有太深入理解) 其次还包括了对不同平台的线程 锁信号的封装实现跨平台。

 

osip 源代码框架详解

https://wenku.baidu.com/view/49462441be1e650e52ea9940.html?sxts=1557060265157
https://wenku.baidu.com/view/7cc81930b90d6c85ec3ac6de.html?rec_flag=default
https://wenku.baidu.com/view/f7988a6b011ca300a6c390ab.html
* osip 开发手册
https://wenku.baidu.com/view/fe5ccbebe009581b6bd9eb18.html?sxts=1557122790420
* osip 状态机的解释(ICT IST NICT NIST)
https://blog.csdn.net/candy1232009/article/details/3926868

https://blog.csdn.net/lbc2100/article/details/48342889

 

osip  sdp 的操作

void sdpTest() {
    char *sdpStr = "v=0\r\n"
    "o=- 3761910912 3761910915 IN IP4 47.112.105.194\r\n"
    "s=butelmedia\r\n"
    "t=0 0\r\n"
    "m=audio 5061 RTP/AVP 98 97 99 0 8\r\n"
    "c=IN IP4 61.149.194.174\r\n"
    "a=sendrecv\r\n"
    "a=rtpmap:98 speex/16000\r\n"
    "a=rtpmap:97 speex/8000\r\n"
    "a=rtpmap:99 speex/32000\r\n"
    "a=rtpmap:0 PCMU/8000\r\n"
    "a=rtpmap:8 PCMA/8000\r\n"
    "a=ssrc:2066561799 cname:30000025\r\n"
    "a=mid:audio-1\r\n"
    "a=rtcp-mux\r\n"
    "a=audiodesc:mic_audio\r\n"
    "m=video 5061 RTP/AVP 97\r\n"
    "c=IN IP4 61.149.194.174\r\n"
    "a=sendrecv\r\n"
    "a=rtpmap:97 H264/90000\r\n"
    "a=fmtp:97 profile-level-id=42e01e; packetization-mode=1\r\n"
    "a=ssrc:931412768 cname:30000025\r\n"
    "a=mid:video-1\r\n"
    "a=rtcp-mux\r\n"
    "a=videodesc:camera\r\n"
    ;
    int ret = 0;
    sdp_message_t *sdp = NULL;
    char *pChar = NULL;

    ret = sdp_message_init (&sdp);
    if(0!=ret) {
        printf("sdp_message_init error %d \n",ret);
        return;
    }
    ret = sdp_message_parse (sdp, sdpStr);
    if(0!=ret) {
        printf("parse error %d \n",ret);
        return;
    }
    pChar = sdp_message_a_att_field_get(sdp,0,0);
    if (pChar) printf("%s \n",pChar);

    int size = strlen("sendonly");
    char * send = (char *)osip_malloc(size);
    memcpy(send,"sendonly",size);
    ret = sdp_message_a_attribute_add (sdp, 0, send, NULL);
    printf("sdp_message_a_attribute_add %d \n",ret);
    ret = sdp_message_a_attribute_del (sdp, 0, "sendrecv");
    printf("sdp_message_a_attribute_del %d \n",ret);

    ret = sdp_message_to_str(sdp,&pChar);
    if(0!=ret) {
        printf("sdp_message_to_str  %d \n",ret);
        return;
    }
    printf("sdp_message_to_str: %s \n",pChar);
    osip_free(pChar);

    sdp_message_free(sdp);

}

  备注: 添加到sdp_message_t 的信息  需要动态分配的信息  因为 sdp_message_free 会释放 

 

posted on 2019-05-08 23:22  swing07  阅读(2709)  评论(0编辑  收藏  举报