PJ_DEF(pj_status_t) pjsip_dlg_set_transport( pjsip_dialog *dlg,
					     const pjsip_tpselector *sel)
{
    /* Validate */
    PJ_ASSERT_RETURN(dlg && sel, PJ_EINVAL);

    /* Start locking the dialog. */
    pjsip_dlg_inc_lock(dlg);

    /* Decrement reference counter of previous transport selector */
    pjsip_tpselector_dec_ref(&dlg->tp_sel);

    /* Copy transport selector structure .*/
    pj_memcpy(&dlg->tp_sel, sel, sizeof(*sel));

    /* Increment reference counter */
    pjsip_tpselector_add_ref(&dlg->tp_sel);

    /* Unlock dialog. */
    pjsip_dlg_dec_lock(dlg);

    return PJ_SUCCESS;
}
PJ_DEF(pj_status_t) pjsip_dlg_set_transport( pjsip_dialog *dlg,
					     const pjsip_tpselector *sel)
{
     
    PJ_ASSERT_RETURN(dlg && sel, PJ_EINVAL);

     
    pjsip_dlg_inc_lock(dlg);

     
    pjsip_tpselector_dec_ref(&dlg->tp_sel);

     
    pj_memcpy(&dlg->tp_sel, sel, sizeof(*sel));

     
    pjsip_tpselector_add_ref(&dlg->tp_sel);

     
    pjsip_dlg_dec_lock(dlg);

    return PJ_SUCCESS;
}