/* * Register header parsers. */ PJ_DEF(void) pjsip_evsub_init_parser(void) { pjsip_register_hdr_parser( "Event", "o", &parse_hdr_event); pjsip_register_hdr_parser( "Subscription-State", NULL, &parse_hdr_sub_state); }
/* * Initialize Replaces support in PJSIP. */ PJ_DEF(pj_status_t) pjsip_replaces_init_module(pjsip_endpoint *endpt) { pj_status_t status; const pj_str_t STR_REPLACES = { "replaces", 8 }; the_endpt = endpt; if (is_initialized) return PJ_SUCCESS; /* Register Replaces header parser */ status = pjsip_register_hdr_parser( "Replaces", NULL, &parse_hdr_replaces); if (status != PJ_SUCCESS) return status; /* Register "replaces" capability */ status = pjsip_endpt_add_capability(endpt, NULL, PJSIP_H_SUPPORTED, NULL, 1, &STR_REPLACES); /* Register deinit module to be executed when PJLIB shutdown */ if (pj_atexit(&pjsip_replaces_deinit_module) != PJ_SUCCESS) { /* Failure to register this function may cause this module won't * work properly when the stack is restarted (without quitting * application). */ pj_assert(!"Failed to register Replaces deinit."); PJ_LOG(1, (THIS_FILE, "Failed to register Replaces deinit.")); } is_initialized = PJ_TRUE; return PJ_SUCCESS; }
PJ_DEF(pj_status_t) pjsip_auth_init_parser() { pj_status_t status; status = pjsip_register_hdr_parser( "Authorization", NULL, &parse_hdr_authorization); PJ_ASSERT_RETURN(status==PJ_SUCCESS, status); status = pjsip_register_hdr_parser( "Proxy-Authorization", NULL, &parse_hdr_proxy_authorization); PJ_ASSERT_RETURN(status==PJ_SUCCESS, status); status = pjsip_register_hdr_parser( "WWW-Authenticate", NULL, &parse_hdr_www_authenticate); PJ_ASSERT_RETURN(status==PJ_SUCCESS, status); status = pjsip_register_hdr_parser( "Proxy-Authenticate", NULL, &parse_hdr_proxy_authenticate); PJ_ASSERT_RETURN(status==PJ_SUCCESS, status); return PJ_SUCCESS; }
/* * Initialize Session Timers support in PJSIP. */ PJ_DEF(pj_status_t) pjsip_timer_init_module(pjsip_endpoint *endpt) { pj_status_t status; PJ_ASSERT_RETURN(endpt, PJ_EINVAL); if (is_initialized) return PJ_SUCCESS; /* Register Session-Expires header parser */ status = pjsip_register_hdr_parser( STR_SE.ptr, STR_SHORT_SE.ptr, &parse_hdr_se); if (status != PJ_SUCCESS) return status; /* Register Min-SE header parser */ status = pjsip_register_hdr_parser( STR_MIN_SE.ptr, NULL, &parse_hdr_min_se); if (status != PJ_SUCCESS) return status; /* Register 'timer' capability to endpoint */ status = pjsip_endpt_add_capability(endpt, NULL, PJSIP_H_SUPPORTED, NULL, 1, &STR_TIMER); if (status != PJ_SUCCESS) return status; /* Register deinit module to be executed when PJLIB shutdown */ if (pjsip_endpt_atexit(endpt, &pjsip_timer_deinit_module) != PJ_SUCCESS) { /* Failure to register this function may cause this module won't * work properly when the stack is restarted (without quitting * application). */ pj_assert(!"Failed to register Session Timer deinit."); PJ_LOG(1, (THIS_FILE, "Failed to register Session Timer deinit.")); } is_initialized = PJ_TRUE; return PJ_SUCCESS; }
/// Register all of our custom header parsers with pjSIP. This should be // called once during startup. pj_status_t register_custom_headers() { pj_status_t status; status = pjsip_register_hdr_parser("Privacy", NULL, &parse_hdr_privacy); PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); status = pjsip_register_hdr_parser("P-Associated-URI", NULL, &parse_hdr_p_associated_uri); PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); status = pjsip_register_hdr_parser("P-Asserted-Identity", NULL, &parse_hdr_p_asserted_identity); PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); status = pjsip_register_hdr_parser("P-Preferred-Identity", NULL, &parse_hdr_p_preferred_identity); PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); status = pjsip_register_hdr_parser("P-Charging-Vector", NULL, &parse_hdr_p_charging_vector); PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); status = pjsip_register_hdr_parser("P-Charging-Function-Addresses", NULL, &parse_hdr_p_charging_function_addresses); PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); status = pjsip_register_hdr_parser("P-Served-User", NULL, &parse_hdr_p_served_user); PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); status = pjsip_register_hdr_parser("Service-Route", NULL, &parse_hdr_service_route); PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); status = pjsip_register_hdr_parser("Path", NULL, &parse_hdr_path); PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); status = pjsip_register_hdr_parser("Session-Expires", NULL, &parse_hdr_session_expires); PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); status = pjsip_register_hdr_parser("Reject-Contact", "j", &parse_hdr_reject_contact); PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); status = pjsip_register_hdr_parser("Accept-Contact", "a", &parse_hdr_accept_contact); PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); return PJ_SUCCESS; }