/*! \brief Function called when an INVITE goes out */ static int nat_incoming_invite_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata) { if (session->inv_session->state == PJSIP_INV_STATE_INCOMING) { pjsip_dlg_add_usage(session->inv_session->dlg, &nat_module, NULL); } return 0; }
int ast_sip_dialog_setup_outbound_authentication(pjsip_dialog *dlg, const struct ast_sip_endpoint *endpoint, ast_sip_dialog_outbound_auth_cb cb, void *user_data) { struct outbound_auth_cb_data *cb_data = PJ_POOL_ZALLOC_T(dlg->pool, struct outbound_auth_cb_data); cb_data->cb = cb; cb_data->user_data = user_data; dlg->sess_count++; pjsip_dlg_add_usage(dlg, &outbound_auth_mod, cb_data); dlg->sess_count--; return 0; }
/* * API: attach 100rel support in invite session. Called by * sip_inv.c */ PJ_DEF(pj_status_t) pjsip_100rel_attach(pjsip_inv_session *inv) { dlg_data *dd; /* Check that 100rel module has been initialized */ PJ_ASSERT_RETURN(mod_100rel.mod.id >= 0, PJ_EINVALIDOP); /* Create and attach as dialog usage */ dd = PJ_POOL_ZALLOC_T(inv->dlg->pool, dlg_data); dd->inv = inv; pjsip_dlg_add_usage(inv->dlg, &mod_100rel.mod, (void*)dd); PJ_LOG(5,(dd->inv->dlg->obj_name, "100rel module attached")); return PJ_SUCCESS; }
/* make call */ void make_call(char *uri, pj_bool_t with_offer) { pj_str_t local = pj_str("sip:localhost" PORT_STR); pj_str_t remote = pj_str(uri); pj_status_t status; status = pjsip_dlg_create_uac(pjsip_ua_instance(), &local, &local, &remote, &remote, &dlg); pj_assert(status == PJ_SUCCESS); pjsip_dlg_inc_lock(dlg); status = pjsip_dlg_add_usage(dlg, &mod_app, NULL); pj_assert(status == PJ_SUCCESS); pjsip_dlg_inc_session(dlg, &mod_app); send_request(&pjsip_invite_method, -1, NULL, with_offer); pjsip_dlg_dec_lock(dlg); }
/*! \brief Function called when an INVITE goes out */ static void websocket_outgoing_invite_request(struct ast_sip_session *session, struct pjsip_tx_data *tdata) { if (session->inv_session->state == PJSIP_INV_STATE_NULL) { pjsip_dlg_add_usage(session->inv_session->dlg, &websocket_module, NULL); } }