Changeset 268


Ignore:
Timestamp:
Mar 2, 2006 9:18:58 PM (18 years ago)
Author:
bennylp
Message:

Added IM and composition indication, and tested

Location:
pjproject/trunk/pjsip
Files:
3 added
11 edited
1 moved

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/build/pjsip_simple.dsp

    r261 r268  
    9898# Begin Source File 
    9999 
     100SOURCE="..\src\pjsip-simple\iscomposing.c" 
     101# End Source File 
     102# Begin Source File 
     103 
    100104SOURCE="..\src\pjsip-simple\pidf.c" 
    101105# End Source File 
     
    126130# Begin Source File 
    127131 
     132SOURCE="..\include\pjsip-simple\iscomposing.h" 
     133# End Source File 
     134# Begin Source File 
     135 
    128136SOURCE="..\include\pjsip-simple\pidf.h" 
    129137# End Source File 
  • pjproject/trunk/pjsip/build/pjsua_lib.dsp

    r238 r268  
    6666# PROP Target_Dir "" 
    6767# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c 
    68 # ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "../include" /I "../../pjmedia/include" /I "../../pjlib-util/include" /I "../../pjlib/include" /D "_DEBUG" /D PJ_WIN32=1 /D PJ_M_I386=1 /D "WIN32" /D "_MBCS" /D "_LIB" /FD /GZ /c 
     68# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "../include" /I "../../pjmedia/include" /I "../../pjlib-util/include" /I "../../pjlib/include" /D "_DEBUG" /D PJ_WIN32=1 /D PJ_M_I386=1 /D "WIN32" /D "_MBCS" /D "_LIB" /FR /FD /GZ /c 
    6969# SUBTRACT CPP /YX 
    7070# ADD BASE RSC /l 0x409 /d "_DEBUG" 
     
    100100# Begin Source File 
    101101 
    102 SOURCE="..\src\pjsua-lib\pjsua_opt.c" 
     102SOURCE="..\src\pjsua-lib\pjsua_im.c" 
    103103# End Source File 
    104104# Begin Source File 
     
    109109 
    110110SOURCE="..\src\pjsua-lib\pjsua_reg.c" 
     111# End Source File 
     112# Begin Source File 
     113 
     114SOURCE="..\src\pjsua-lib\pjsua_settings.c" 
    111115# End Source File 
    112116# End Group 
  • pjproject/trunk/pjsip/include/pjsip-simple/errno.h

    r212 r268  
    2929 
    3030 
     31/************************************************************ 
     32 * EVENT PACKAGE ERRORS 
     33 ***********************************************************/ 
    3134/** 
    3235 * @hideinitializer 
     
    4144 
    4245 
     46/************************************************************ 
     47 * PRESENCE ERROR 
     48 ***********************************************************/ 
    4349/** 
    4450 * @hideinitializer 
     
    7379 
    7480 
     81/************************************************************ 
     82 * ISCOMPOSING ERRORS 
     83 ***********************************************************/ 
     84/** 
     85 * @hideinitializer 
     86 * Bad isComposing XML message. 
     87 */ 
     88#define PJSIP_SIMPLE_EBADISCOMPOSE  (PJSIP_SIMPLE_ERRNO_START+40)   /*270040*/ 
     89 
    7590 
    7691#endif  /* __PJSIP_SIMPLE_ERRNO_H__ */ 
  • pjproject/trunk/pjsip/include/pjsip_simple.h

    r197 r268  
    3535 
    3636#include <pjsip-simple/evsub.h> 
     37#include <pjsip-simple/iscomposing.h> 
    3738#include <pjsip-simple/presence.h> 
    3839#include <pjsip-simple/pidf.h> 
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h

    r255 r268  
    355355 
    356356/** 
     357 * Send instant messaging inside INVITE session. 
     358 */ 
     359void pjsua_call_send_im(int call_index, const char *text); 
     360 
     361 
     362/** 
     363 * Send IM typing indication inside INVITE session. 
     364 */ 
     365void pjsua_call_typing(int call_index, pj_bool_t is_typing); 
     366 
     367/** 
    357368 * Terminate all calls. 
    358369 */ 
     
    406417 
    407418/***************************************************************************** 
     419 * PJSUA Instant Messaging (pjsua_im.c) 
     420 */ 
     421 
     422/** 
     423 * The MESSAGE method (defined in pjsua_im.c) 
     424 */ 
     425extern const pjsip_method pjsip_message_method; 
     426 
     427 
     428/** 
     429 * Init IM module handler to handle incoming MESSAGE outside dialog. 
     430 */ 
     431pj_status_t pjsua_im_init(); 
     432 
     433 
     434/** 
     435 * Create Accept header for MESSAGE. 
     436 */ 
     437pjsip_accept_hdr* pjsua_im_create_accept(pj_pool_t *pool); 
     438 
     439/** 
     440 * Send IM outside dialog. 
     441 */ 
     442pj_status_t pjsua_im_send(int acc_index, const char *dst_uri,  
     443                          const char *text); 
     444 
     445 
     446/** 
     447 * Send typing indication outside dialog. 
     448 */ 
     449pj_status_t pjsua_im_typing(int acc_index, const char *dst_uri,  
     450                            pj_bool_t is_typing); 
     451 
     452 
     453/** 
     454 * Private: check if we can accept the message. 
     455 *          If not, then p_accept header will be filled with a valid 
     456 *          Accept header. 
     457 */ 
     458pj_bool_t pjsua_im_accept_pager(pjsip_rx_data *rdata, 
     459                                const pjsip_accept_hdr **p_accept_hdr); 
     460 
     461/** 
     462 * Private: process pager message. 
     463 *          This may trigger pjsua_ui_on_pager() or pjsua_ui_on_typing(). 
     464 */ 
     465void pjsua_im_process_pager(int call_id, const pj_str_t *from, 
     466                            const pj_str_t *to, pjsip_rx_data *rdata); 
     467 
     468 
     469/***************************************************************************** 
    408470 * User Interface API. 
    409471 * 
     
    415477 * Notify UI when invite state has changed. 
    416478 */ 
    417 void pjsua_ui_inv_on_state_changed(int call_index, pjsip_event *e); 
     479void pjsua_ui_on_call_state(int call_index, pjsip_event *e); 
    418480 
    419481/** 
    420482 * Notify UI when registration status has changed. 
    421483 */ 
    422 void pjsua_ui_regc_on_state_changed(int acc_index); 
     484void pjsua_ui_on_reg_state(int acc_index); 
     485 
     486/** 
     487 * Notify UI on incoming pager (i.e. MESSAGE request). 
     488 * Argument call_index will be -1 if MESSAGE request is not related to an  
     489 * existing call. 
     490 */ 
     491void pjsua_ui_on_pager(int call_index, const pj_str_t *from, 
     492                       const pj_str_t *to, const pj_str_t *txt); 
     493 
     494 
     495/** 
     496 * Notify UI about typing indication. 
     497 */ 
     498void pjsua_ui_on_typing(int call_index, const pj_str_t *from, 
     499                        const pj_str_t *to, pj_bool_t is_typing); 
    423500 
    424501 
  • pjproject/trunk/pjsip/src/pjsip-simple/errno.c

    r212 r268  
    3030} err_str[] =  
    3131{ 
     32    /* Event errors */ 
    3233    { PJSIP_SIMPLE_ENOPKG,          "No SIP event package with the specified name" }, 
    3334    { PJSIP_SIMPLE_EPKGEXISTS,      "SIP event package already exist" }, 
    3435 
     36    /* Presence errors */ 
    3537    { PJSIP_SIMPLE_ENOTSUBSCRIBE,   "Expecting SUBSCRIBE request" }, 
    3638    { PJSIP_SIMPLE_ENOPRESENCE,     "No presence associated with the subscription" }, 
     
    3941    { PJSIP_SIMPLE_EBADPIDF,        "Bad PIDF content for presence" }, 
    4042    { PJSIP_SIMPLE_EBADXPIDF,       "Bad XPIDF content for presence" }, 
     43 
     44    /* isComposing errors. */ 
     45    { PJSIP_SIMPLE_EBADISCOMPOSE,   "Bad isComposing indication/XML message" }, 
    4146}; 
    4247 
  • pjproject/trunk/pjsip/src/pjsip-simple/evsub.c

    r230 r268  
    957957                       pjsip_hdr_shallow_clone(tdata->pool, sub->expires)); 
    958958 
     959    /* Add additional header, if any. */ 
     960    if (hdr_list) { 
     961        const pjsip_hdr *hdr = hdr_list->next; 
     962        while (hdr != hdr_list) { 
     963            pjsip_msg_add_hdr( tdata->msg, 
     964                               pjsip_hdr_clone(tdata->pool, hdr)); 
     965            hdr = hdr->next; 
     966        } 
     967    } 
    959968 
    960969    /* Send the response: */ 
     
    13251334    /* Add msg body, if any */ 
    13261335    if (body) { 
    1327         tdata->msg->body = pj_pool_zalloc(tdata->pool,  
    1328                                           sizeof(pjsip_msg_body)); 
    1329         status = pjsip_msg_body_clone(tdata->pool,  
    1330                                       tdata->msg->body,  
    1331                                       body); 
    1332         if (status != PJ_SUCCESS) { 
    1333             tdata->msg->body = NULL; 
     1336        tdata->msg->body = pjsip_msg_body_clone(tdata->pool, body); 
     1337        if (tdata->msg->body == NULL) { 
     1338 
     1339            PJ_LOG(4,(THIS_FILE, "Error: unable to clone msg body")); 
     1340 
    13341341            /* Ignore */ 
    13351342            return PJ_SUCCESS; 
  • pjproject/trunk/pjsip/src/pjsip-simple/presence.c

    r230 r268  
    787787 
    788788/* 
     789 * Process the content of incoming NOTIFY request and update temporary 
     790 * status. 
     791 * 
     792 * return PJ_SUCCESS if incoming request is acceptable. If return value 
     793 *        is not PJ_SUCCESS, res_hdr may be added with Warning header. 
     794 */ 
     795static pj_status_t pres_process_rx_notify( pjsip_pres *pres, 
     796                                           pjsip_rx_data *rdata,  
     797                                           int *p_st_code, 
     798                                           pj_str_t **p_st_text, 
     799                                           pjsip_hdr *res_hdr) 
     800{ 
     801    pjsip_ctype_hdr *ctype_hdr; 
     802    pj_status_t status; 
     803 
     804    *p_st_text = NULL; 
     805 
     806    /* Check Content-Type and msg body are present. */ 
     807    ctype_hdr = rdata->msg_info.ctype; 
     808 
     809    if (ctype_hdr==NULL || rdata->msg_info.msg->body==NULL) { 
     810         
     811        pjsip_warning_hdr *warn_hdr; 
     812        pj_str_t warn_text; 
     813 
     814        *p_st_code = PJSIP_SC_BAD_REQUEST; 
     815 
     816        warn_text = pj_str("Message body is not present"); 
     817        warn_hdr = pjsip_warning_hdr_create(rdata->tp_info.pool, 399, 
     818                                            pjsip_endpt_name(pres->dlg->endpt), 
     819                                            &warn_text); 
     820        pj_list_push_back(res_hdr, warn_hdr); 
     821 
     822        return PJSIP_ERRNO_FROM_SIP_STATUS(PJSIP_SC_BAD_REQUEST); 
     823    } 
     824 
     825    /* Parse content. */ 
     826 
     827    if (pj_stricmp(&ctype_hdr->media.type, &STR_APPLICATION)==0 && 
     828        pj_stricmp(&ctype_hdr->media.subtype, &STR_PIDF_XML)==0) 
     829    { 
     830        status = pres_parse_pidf( pres, rdata, &pres->tmp_status); 
     831    } 
     832    else  
     833    if (pj_stricmp(&ctype_hdr->media.type, &STR_APPLICATION)==0 && 
     834        pj_stricmp(&ctype_hdr->media.subtype, &STR_XPIDF_XML)==0) 
     835    { 
     836        status = pres_parse_xpidf( pres, rdata, &pres->tmp_status); 
     837    } 
     838    else 
     839    { 
     840        status = PJSIP_SIMPLE_EBADCONTENT; 
     841    } 
     842 
     843    if (status != PJ_SUCCESS) { 
     844        /* Unsupported or bad Content-Type */ 
     845        pjsip_accept_hdr *accept_hdr; 
     846        pjsip_warning_hdr *warn_hdr; 
     847 
     848        *p_st_code = PJSIP_SC_NOT_ACCEPTABLE_HERE; 
     849 
     850        /* Add Accept header */ 
     851        accept_hdr = pjsip_accept_hdr_create(rdata->tp_info.pool); 
     852        accept_hdr->values[accept_hdr->count++] = STR_APP_PIDF_XML; 
     853        accept_hdr->values[accept_hdr->count++] = STR_APP_XPIDF_XML; 
     854        pj_list_push_back(res_hdr, accept_hdr); 
     855 
     856        /* Add Warning header */ 
     857        warn_hdr = pjsip_warning_hdr_create_from_status( 
     858                                    rdata->tp_info.pool, 
     859                                    pjsip_endpt_name(pres->dlg->endpt), 
     860                                    status); 
     861        pj_list_push_back(res_hdr, warn_hdr); 
     862 
     863        return status; 
     864    } 
     865 
     866    /* If application calls pres_get_status(), redirect the call to 
     867     * retrieve the temporary status. 
     868     */ 
     869    pres->tmp_status._is_valid = PJ_TRUE; 
     870 
     871    return PJ_SUCCESS; 
     872} 
     873 
     874 
     875/* 
    789876 * Called when NOTIFY is received. 
    790877 */ 
     
    796883                                     pjsip_msg_body **p_body) 
    797884{ 
    798     pjsip_ctype_hdr *ctype_hdr; 
    799885    pjsip_pres *pres; 
    800886    pj_status_t status; 
     
    803889    PJ_ASSERT_ON_FAIL(pres!=NULL, {return;}); 
    804890 
    805     /* Check Content-Type and msg body are present. */ 
    806     ctype_hdr = rdata->msg_info.ctype; 
    807  
    808     if (ctype_hdr==NULL || rdata->msg_info.msg->body==NULL) { 
    809          
    810         pjsip_warning_hdr *warn_hdr; 
    811         pj_str_t warn_text; 
    812  
    813         *p_st_code = PJSIP_SC_BAD_REQUEST; 
    814  
    815         warn_text = pj_str("Message body is not present"); 
    816         warn_hdr = pjsip_warning_hdr_create(rdata->tp_info.pool, 399, 
    817                                             pjsip_endpt_name(pres->dlg->endpt), 
    818                                             &warn_text); 
    819         pj_list_push_back(res_hdr, warn_hdr); 
    820  
    821         return; 
    822     } 
    823  
    824     /* Parse content. */ 
    825  
    826     if (pj_stricmp(&ctype_hdr->media.type, &STR_APPLICATION)==0 && 
    827         pj_stricmp(&ctype_hdr->media.subtype, &STR_PIDF_XML)==0) 
    828     { 
    829         status = pres_parse_pidf( pres, rdata, &pres->tmp_status); 
    830     } 
    831     else  
    832     if (pj_stricmp(&ctype_hdr->media.type, &STR_APPLICATION)==0 && 
    833         pj_stricmp(&ctype_hdr->media.subtype, &STR_XPIDF_XML)==0) 
    834     { 
    835         status = pres_parse_xpidf( pres, rdata, &pres->tmp_status); 
    836     } 
    837     else 
    838     { 
    839         status = PJSIP_SIMPLE_EBADCONTENT; 
    840     } 
    841  
    842     if (status != PJ_SUCCESS) { 
    843         /* Unsupported or bad Content-Type */ 
    844         pjsip_accept_hdr *accept_hdr; 
    845         pjsip_warning_hdr *warn_hdr; 
    846  
    847         *p_st_code = PJSIP_SC_NOT_ACCEPTABLE_HERE; 
    848  
    849         /* Add Accept header */ 
    850         accept_hdr = pjsip_accept_hdr_create(rdata->tp_info.pool); 
    851         accept_hdr->values[accept_hdr->count++] = STR_APP_PIDF_XML; 
    852         accept_hdr->values[accept_hdr->count++] = STR_APP_XPIDF_XML; 
    853         pj_list_push_back(res_hdr, accept_hdr); 
    854  
    855         /* Add Warning header */ 
    856         warn_hdr = pjsip_warning_hdr_create_from_status( 
    857                                     rdata->tp_info.pool, 
    858                                     pjsip_endpt_name(pres->dlg->endpt), 
    859                                     status); 
    860         pj_list_push_back(res_hdr, warn_hdr); 
    861  
    862         return; 
    863     } 
    864  
    865     /* If application calls pres_get_status(), redirect the call to 
    866      * retrieve the temporary status. 
     891    /* Only process the message body if it exists, otherwise treat as 
     892     * presence status is closed.  
    867893     */ 
    868     pres->tmp_status._is_valid = PJ_TRUE; 
     894    if (rdata->msg_info.msg->body) { 
     895        status = pres_process_rx_notify( pres, rdata, p_st_code, p_st_text, 
     896                                         res_hdr ); 
     897        if (status != PJ_SUCCESS) 
     898            return; 
     899 
     900    } else { 
     901        unsigned i; 
     902 
     903        /* Subscription is terminated. Consider contact is offline */ 
     904        pres->tmp_status._is_valid = PJ_TRUE; 
     905        for (i=0; i<pres->tmp_status.info_cnt; ++i) 
     906            pres->tmp_status.info[i].basic_open = PJ_FALSE; 
     907    } 
    869908 
    870909    /* Notify application. */ 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r255 r268  
    2222 
    2323/* 
    24  * pjsua_inv.c 
     24 * pjsua_call.c 
    2525 * 
    26  * Invite session specific functionalities. 
     26 * Call (INVITE) related stuffs. 
    2727 */ 
    2828 
     
    260260    if (status != PJ_SUCCESS) { 
    261261 
    262         pjsip_dlg_respond(dlg, rdata, 500, NULL); 
     262        pjsip_dlg_respond(dlg, rdata, 500, NULL, NULL, NULL); 
    263263 
    264264        // TODO: Need to delete dialog 
     
    286286        pjsua_perror(THIS_FILE, "Unable to create 100 response", status); 
    287287 
    288         pjsip_dlg_respond(dlg, rdata, 500, NULL); 
     288        pjsip_dlg_respond(dlg, rdata, 500, NULL, NULL, NULL); 
    289289 
    290290        // TODO: Need to delete dialog 
     
    386386 
    387387 
    388     pjsua_ui_inv_on_state_changed(call->index, e); 
     388    pjsua_ui_on_call_state(call->index, e); 
    389389 
    390390    /* call->inv may be NULL now */ 
     
    464464         */ 
    465465        PJ_LOG(4,(THIS_FILE, "Received REFER without Refer-To header!")); 
    466         pjsip_dlg_respond( inv->dlg, rdata, 400, NULL); 
     466        pjsip_dlg_respond( inv->dlg, rdata, 400, NULL, NULL, NULL); 
    467467        return; 
    468468    } 
     
    482482    if (status != PJ_SUCCESS) { 
    483483        pjsua_perror(THIS_FILE, "Unable to create xfer uas", status); 
    484         pjsip_dlg_respond( inv->dlg, rdata, 500, NULL); 
     484        pjsip_dlg_respond( inv->dlg, rdata, 500, NULL, NULL, NULL); 
    485485        return; 
    486486    } 
     
    546546/* 
    547547 * This callback is called when transaction state has changed in INVITE 
    548  * session. We use this to trap incoming REFER request. 
     548 * session. We use this to trap: 
     549 *  - incoming REFER request. 
     550 *  - incoming MESSAGE request. 
    549551 */ 
    550552static void pjsua_call_on_tsx_state_changed(pjsip_inv_session *inv, 
     
    562564         */ 
    563565        on_call_transfered(call->inv, e->body.tsx_state.src.rdata); 
    564     } 
     566 
     567    } 
     568    else if (tsx->role==PJSIP_ROLE_UAS && 
     569             tsx->state==PJSIP_TSX_STATE_TRYING && 
     570             pjsip_method_cmp(&tsx->method, &pjsip_message_method)==0) 
     571    { 
     572        /* 
     573         * Incoming MESSAGE request! 
     574         */ 
     575        pjsip_rx_data *rdata; 
     576        pjsip_msg *msg; 
     577        pjsip_accept_hdr *accept_hdr; 
     578        pj_status_t status; 
     579 
     580        rdata = e->body.tsx_state.src.rdata; 
     581        msg = rdata->msg_info.msg; 
     582 
     583        /* Request MUST have message body, with Content-Type equal to 
     584         * "text/plain". 
     585         */ 
     586        if (pjsua_im_accept_pager(rdata, &accept_hdr) == PJ_FALSE) { 
     587 
     588            pjsip_hdr hdr_list; 
     589 
     590            pj_list_init(&hdr_list); 
     591            pj_list_push_back(&hdr_list, accept_hdr); 
     592 
     593            pjsip_dlg_respond( inv->dlg, rdata, PJSIP_SC_NOT_ACCEPTABLE_HERE,  
     594                               NULL, &hdr_list, NULL ); 
     595            return; 
     596        } 
     597 
     598        /* Respond with 200 first, so that remote doesn't retransmit in case 
     599         * the UI takes too long to process the message.  
     600         */ 
     601        status = pjsip_dlg_respond( inv->dlg, rdata, 200, NULL, NULL, NULL); 
     602 
     603        /* Process MESSAGE request */ 
     604        pjsua_im_process_pager(call->index, &inv->dlg->remote.info_str, 
     605                               &inv->dlg->local.info_str, rdata); 
     606    } 
     607 
    565608} 
    566609 
     
    10461089 
    10471090 
     1091/** 
     1092 * Send instant messaging inside INVITE session. 
     1093 */ 
     1094void pjsua_call_send_im(int call_index, const char *str) 
     1095{ 
     1096    pjsua_call *call; 
     1097    const pj_str_t mime_text = pj_str("text"); 
     1098    const pj_str_t mime_plain = pj_str("plain"); 
     1099    pj_str_t text; 
     1100    pjsip_tx_data *tdata; 
     1101    pj_status_t status; 
     1102 
     1103    call = &pjsua.calls[call_index]; 
     1104 
     1105    if (!call->inv) { 
     1106        PJ_LOG(3,(THIS_FILE,"Call has been disconnected")); 
     1107        return; 
     1108    } 
     1109 
     1110    /* Lock dialog. */ 
     1111    pjsip_dlg_inc_lock(call->inv->dlg); 
     1112     
     1113    /* Create request message. */ 
     1114    status = pjsip_dlg_create_request( call->inv->dlg, &pjsip_message_method, 
     1115                                       -1, &tdata); 
     1116    if (status != PJ_SUCCESS) { 
     1117        pjsua_perror(THIS_FILE, "Unable to create MESSAGE request", status); 
     1118        goto on_return; 
     1119    } 
     1120 
     1121    /* Add accept header. */ 
     1122    pjsip_msg_add_hdr( tdata->msg,  
     1123                       (pjsip_hdr*)pjsua_im_create_accept(tdata->pool)); 
     1124 
     1125    /* Create "text/plain" message body. */ 
     1126    tdata->msg->body = pjsip_msg_body_create( tdata->pool, &mime_text, 
     1127                                              &mime_plain,  
     1128                                              pj_cstr(&text, str)); 
     1129    if (tdata->msg->body == NULL) { 
     1130        pjsua_perror(THIS_FILE, "Unable to create msg body", PJ_ENOMEM); 
     1131        pjsip_tx_data_dec_ref(tdata); 
     1132        goto on_return; 
     1133    } 
     1134 
     1135    /* Send the request. */ 
     1136    status = pjsip_dlg_send_request( call->inv->dlg, tdata, NULL); 
     1137    if (status != PJ_SUCCESS) { 
     1138        pjsua_perror(THIS_FILE, "Unable to send MESSAGE request", status); 
     1139        goto on_return; 
     1140    } 
     1141 
     1142on_return: 
     1143    pjsip_dlg_dec_lock(call->inv->dlg); 
     1144} 
     1145 
     1146 
     1147/** 
     1148 * Send IM typing indication inside INVITE session. 
     1149 */ 
     1150void pjsua_call_typing(int call_index, pj_bool_t is_typing) 
     1151{ 
     1152    pjsua_call *call; 
     1153    pjsip_tx_data *tdata; 
     1154    pj_status_t status; 
     1155 
     1156    call = &pjsua.calls[call_index]; 
     1157 
     1158    if (!call->inv) { 
     1159        PJ_LOG(3,(THIS_FILE,"Call has been disconnected")); 
     1160        return; 
     1161    } 
     1162 
     1163    /* Lock dialog. */ 
     1164    pjsip_dlg_inc_lock(call->inv->dlg); 
     1165     
     1166    /* Create request message. */ 
     1167    status = pjsip_dlg_create_request( call->inv->dlg, &pjsip_message_method, 
     1168                                       -1, &tdata); 
     1169    if (status != PJ_SUCCESS) { 
     1170        pjsua_perror(THIS_FILE, "Unable to create MESSAGE request", status); 
     1171        goto on_return; 
     1172    } 
     1173 
     1174    /* Create "application/im-iscomposing+xml" msg body. */ 
     1175    tdata->msg->body = pjsip_iscomposing_create_body(tdata->pool, is_typing, 
     1176                                                     NULL, NULL, -1); 
     1177 
     1178    /* Send the request. */ 
     1179    status = pjsip_dlg_send_request( call->inv->dlg, tdata, NULL); 
     1180    if (status != PJ_SUCCESS) { 
     1181        pjsua_perror(THIS_FILE, "Unable to send MESSAGE request", status); 
     1182        goto on_return; 
     1183    } 
     1184 
     1185on_return: 
     1186    pjsip_dlg_dec_lock(call->inv->dlg);} 
     1187 
     1188 
    10481189/* 
    10491190 * Terminate all calls. 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r255 r268  
    510510    pjsua_pres_init(); 
    511511 
     512    /* Init out-of-dialog MESSAGE request handler. */ 
     513 
     514    pjsua_im_init(); 
     515 
    512516 
    513517    /* Init media endpoint: */ 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_reg.c

    r253 r268  
    7878    acc->reg_last_code = param->code; 
    7979 
    80     pjsua_ui_regc_on_state_changed(acc->index); 
     80    pjsua_ui_on_reg_state(acc->index); 
    8181} 
    8282 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_settings.c

    r255 r268  
    1919#include <pjsua-lib/pjsua.h> 
    2020#include <pjsua-lib/getopt.h> 
     21 
     22/* 
     23 * pjsua_settings.c 
     24 * 
     25 * Anything to do with configuration and state dump. 
     26 */ 
    2127 
    2228#define THIS_FILE   "pjsua_opt.c" 
Note: See TracChangeset for help on using the changeset viewer.