Ignore:
Timestamp:
Oct 26, 2009 11:21:37 AM (15 years ago)
Author:
bennylp
Message:

Implement ticket #982: Support for SIP Message Summary/Message? Waiting Indication (MWI, RFC 3842)

  • PJSIP-SIMPLE:
    • implement MWI
  • PJSUA-LIB:
    • added "mwi_enabled" flag in account config
    • added "on_mwi_info" callback
  • pjsua app:
    • added "--mwi" option to enable MWI on account
    • added simple callback to log the NOTIFY message
  • other:
    • added SIPp scenario files to simulate UAS side
  • build:
    • added MWI support on VS6, VS2005, MMP, and Makefile
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c

    r2966 r2968  
    194194    puts  ("  --password=string   Set authentication password"); 
    195195    puts  ("  --publish           Send presence PUBLISH for this account"); 
     196    puts  ("  --mwi               Subscribe to message summary/waiting indication"); 
    196197    puts  ("  --use-100rel        Require reliable provisional response (100rel)"); 
    197198    puts  ("  --use-timer         Require SIP session timers"); 
     
    484485           OPT_BOUND_ADDR, OPT_CONTACT_PARAMS, OPT_CONTACT_URI_PARAMS, 
    485486           OPT_100REL, OPT_USE_IMS, OPT_REALM, OPT_USERNAME, OPT_PASSWORD, 
    486            OPT_NAMESERVER, OPT_STUN_SRV, 
     487           OPT_MWI, OPT_NAMESERVER, OPT_STUN_SRV, 
    487488           OPT_ADD_BUDDY, OPT_OFFER_X_MS_MSG, OPT_NO_PRESENCE, 
    488489           OPT_AUTO_ANSWER, OPT_AUTO_PLAY, OPT_AUTO_PLAY_HANGUP, OPT_AUTO_LOOP, 
     
    536537        { "reg-timeout",1, 0, OPT_REG_TIMEOUT}, 
    537538        { "publish",    0, 0, OPT_PUBLISH}, 
     539        { "mwi",        0, 0, OPT_MWI}, 
    538540        { "use-100rel", 0, 0, OPT_100REL}, 
    539541        { "use-ims",    0, 0, OPT_USE_IMS}, 
     
    834836            break; 
    835837 
     838        case OPT_MWI:   /* mwi */ 
     839            cur_acc->mwi_enabled = PJ_TRUE; 
     840            break; 
     841 
    836842        case OPT_100REL: /** 100rel */ 
    837843            cur_acc->require_100rel = PJ_TRUE; 
     
    15511557    } 
    15521558 
     1559    /* Publish */ 
     1560    if (acc_cfg->publish_enabled) 
     1561        pj_strcat2(result, "--publish\n"); 
     1562 
     1563    /* MWI */ 
     1564    if (acc_cfg->mwi_enabled) 
     1565        pj_strcat2(result, "--mwi\n"); 
    15531566} 
    15541567 
     
    27402753        PJ_LOG(3, (THIS_FILE, "NAT detected as %s", res->nat_type_name)); 
    27412754    } 
     2755} 
     2756 
     2757 
     2758/* 
     2759 * MWI indication 
     2760 */ 
     2761static void on_mwi_info(pjsua_acc_id acc_id, pjsua_mwi_info *mwi_info) 
     2762{ 
     2763    pj_str_t body; 
     2764     
     2765    PJ_LOG(3,(THIS_FILE, "Received MWI for acc %d:", acc_id)); 
     2766 
     2767    if (mwi_info->rdata->msg_info.ctype) { 
     2768        const pjsip_ctype_hdr *ctype = mwi_info->rdata->msg_info.ctype; 
     2769 
     2770        PJ_LOG(3,(THIS_FILE, " Content-Type: %.*s/%.*s", 
     2771                  (int)ctype->media.type.slen, 
     2772                  ctype->media.type.ptr, 
     2773                  (int)ctype->media.subtype.slen, 
     2774                  ctype->media.subtype.ptr)); 
     2775    } 
     2776 
     2777    if (!mwi_info->rdata->msg_info.msg->body) { 
     2778        PJ_LOG(3,(THIS_FILE, "  no message body")); 
     2779        return; 
     2780    } 
     2781 
     2782    body.ptr = mwi_info->rdata->msg_info.msg->body->data; 
     2783    body.slen = mwi_info->rdata->msg_info.msg->body->len; 
     2784 
     2785    PJ_LOG(3,(THIS_FILE, " Body:\n%.*s", (int)body.slen, body.ptr)); 
    27422786} 
    27432787 
     
    43384382    app_config.cfg.cb.on_call_replaced = &on_call_replaced; 
    43394383    app_config.cfg.cb.on_nat_detect = &on_nat_detect; 
     4384    app_config.cfg.cb.on_mwi_info = &on_mwi_info; 
    43404385 
    43414386    /* Set sound device latency */ 
Note: See TracChangeset for help on using the changeset viewer.