Changeset 332


Ignore:
Timestamp:
Mar 18, 2006 12:29:01 PM (19 years ago)
Author:
bennylp
Message:

Added comment on how to add credentials and route set in the dialog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/samples/simpleua.c

    r329 r332  
    320320        } 
    321321 
     322        /* If we expect the outgoing INVITE to be challenged, then we should 
     323         * put the credentials in the dialog here, with something like this: 
     324         * 
     325            { 
     326                pjsip_cred_info cred[1]; 
     327 
     328                cred[0].realm     = pj_str("sip.server.realm"); 
     329                cred[0].username  = pj_str("theuser"); 
     330                cred[0].data_type = PJSIP_CRED_DATA_PLAIN_PASSWD; 
     331                cred[0].data      = pj_str("thepassword"); 
     332 
     333                pjsip_auth_clt_set_credentials( &dlg->auth_sess, 1, cred); 
     334            } 
     335         * 
     336         */ 
     337 
     338 
     339        /* If we want the initial INVITE to travel to specific SIP proxies, 
     340         * then we should put the initial dialog's route set here. The final 
     341         * route set will be updated once a dialog has been established. 
     342         * To set the dialog's initial route set, we do it with something 
     343         * like this: 
     344         * 
     345            { 
     346                pjsip_route_hdr route_set; 
     347                pjsip_route_hdr *route; 
     348                const pj_str_t hname = { "Route", 5 }; 
     349                char *uri = "sip:proxy.server;lr"; 
     350 
     351                pj_list_init(&route_set); 
     352 
     353                route = pjsip_parse_hdr( dlg->pool, &hname,  
     354                                         uri, strlen(uri), 
     355                                         NULL); 
     356                PJ_ASSERT_RETURN(route != NULL, 1); 
     357                pj_list_push_back(&route_set, route); 
     358 
     359                pjsip_dlg_set_route_set(dlg, &route_set); 
     360            } 
     361         * 
     362         * Note that Route URI SHOULD have an ";lr" parameter! 
     363         */ 
     364 
     365 
    322366        /* Get the SDP body to be put in the outgoing INVITE, by asking 
    323367         * media endpoint to create one for us. The SDP will contain all 
     
    341385 
    342386 
    343  
    344387        /* Create initial INVITE request. 
    345388         * This INVITE request will contain a perfectly good request and  
     
    371414        pj_time_val timeout = {0, 10}; 
    372415        pjsip_endpt_handle_events(g_endpt, &timeout); 
     416    } 
     417 
     418    /* On exit, dump memory usage: */ 
     419    { 
     420        pj_pool_t   *p; 
     421        unsigned     total_alloc = 0; 
     422        unsigned     total_used = 0; 
     423 
     424        /* Accumulate memory usage in active list. */ 
     425        p = cp.used_list.next; 
     426        while (p != (pj_pool_t*) &cp.used_list) { 
     427            total_alloc += pj_pool_get_capacity(p); 
     428            total_used += pj_pool_get_used_size(p); 
     429            p = p->next; 
     430        } 
     431 
     432        printf("Total pool memory allocated=%d KB, used=%d KB\n", 
     433                total_alloc / 1000, 
     434                total_used / 1000); 
    373435    } 
    374436 
Note: See TracChangeset for help on using the changeset viewer.