static int load_module(void) { CHECK_PJSIP_MODULE_LOADED(); if (ast_sip_register_subscription_handler(&mwi_handler)) { return AST_MODULE_LOAD_DECLINE; } unsolicited_mwi = ao2_container_alloc(MWI_BUCKETS, mwi_sub_hash, mwi_sub_cmp); if (!unsolicited_mwi) { ast_sip_unregister_subscription_handler(&mwi_handler); return AST_MODULE_LOAD_DECLINE; } create_mwi_subscriptions(); ast_sorcery_observer_add(ast_sip_get_sorcery(), "contact", &mwi_contact_observer); if (ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) { ast_sip_push_task(NULL, send_initial_notify_all, NULL); } else { stasis_subscribe_pool(ast_manager_get_topic(), mwi_startup_event_cb, NULL); } return AST_MODULE_LOAD_SUCCESS; }
static int load_module(void) { CHECK_PJSIP_MODULE_LOADED(); ast_sip_register_endpoint_identifier_with_name(&username_identifier, "username"); return AST_MODULE_LOAD_SUCCESS; }
static int load_module(void) { CHECK_PJSIP_MODULE_LOADED(); ast_sip_register_endpoint_identifier(&anonymous_identifier); return AST_MODULE_LOAD_SUCCESS; }
static int load_module(void) { char hostname[MAXHOSTNAMELEN] = ""; pj_sockaddr addr; CHECK_PJSIP_MODULE_LOADED(); if (!gethostname(hostname, sizeof(hostname) - 1)) { ast_verb(2, "Performing DNS resolution of local hostname '%s' to get local IPv4 and IPv6 address\n", hostname); } if (!pj_gethostip(pj_AF_INET(), &addr)) { pj_sockaddr_print(&addr, host_ipv4, sizeof(host_ipv4), 2); ast_verb(3, "Local IPv4 address determined to be: %s\n", host_ipv4); } if (!pj_gethostip(pj_AF_INET6(), &addr)) { pj_sockaddr_print(&addr, host_ipv6, sizeof(host_ipv6), 2); ast_verb(3, "Local IPv6 address determined to be: %s\n", host_ipv6); } if (ast_sip_register_service(&multihomed_module)) { ast_log(LOG_ERROR, "Could not register multihomed module for incoming and outgoing requests\n"); return AST_MODULE_LOAD_FAILURE; } return AST_MODULE_LOAD_SUCCESS; }
static int load_module(void) { CHECK_PJSIP_MODULE_LOADED(); ast_sorcery_apply_config(ast_sip_get_sorcery(), SIP_SORCERY_ACL_TYPE); ast_sorcery_apply_default(ast_sip_get_sorcery(), SIP_SORCERY_ACL_TYPE, "config", "pjsip.conf,criteria=type=acl"); if (ast_sorcery_object_register(ast_sip_get_sorcery(), SIP_SORCERY_ACL_TYPE, acl_alloc, NULL, NULL)) { ast_log(LOG_ERROR, "Failed to register SIP %s object with sorcery\n", SIP_SORCERY_ACL_TYPE); return AST_MODULE_LOAD_DECLINE; } ast_sorcery_object_field_register(ast_sip_get_sorcery(), SIP_SORCERY_ACL_TYPE, "type", "", OPT_NOOP_T, 0, 0); ast_sorcery_object_field_register_custom(ast_sip_get_sorcery(), SIP_SORCERY_ACL_TYPE, "permit", "", acl_handler, NULL, NULL, 0, 0); ast_sorcery_object_field_register_custom(ast_sip_get_sorcery(), SIP_SORCERY_ACL_TYPE, "deny", "", acl_handler, NULL, NULL, 0, 0); ast_sorcery_object_field_register_custom(ast_sip_get_sorcery(), SIP_SORCERY_ACL_TYPE, "acl", "", acl_handler, NULL, NULL, 0, 0); ast_sorcery_object_field_register_custom(ast_sip_get_sorcery(), SIP_SORCERY_ACL_TYPE, "contact_permit", "", acl_handler, NULL, NULL, 0, 0); ast_sorcery_object_field_register_custom(ast_sip_get_sorcery(), SIP_SORCERY_ACL_TYPE, "contact_deny", "", acl_handler, NULL, NULL, 0, 0); ast_sorcery_object_field_register_custom(ast_sip_get_sorcery(), SIP_SORCERY_ACL_TYPE, "contact_acl", "", acl_handler, NULL, NULL, 0, 0); ast_sorcery_load_object(ast_sip_get_sorcery(), SIP_SORCERY_ACL_TYPE); ast_sip_register_service(&acl_module); return AST_MODULE_LOAD_SUCCESS; }
static int load_module(void) { CHECK_PJSIP_MODULE_LOADED(); contact_autoexpire = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, CONTACT_AUTOEXPIRE_BUCKETS, contact_expiration_hash, contact_expiration_cmp); if (!contact_autoexpire) { ast_log(LOG_ERROR, "Could not create container for contact auto-expiration\n"); return AST_MODULE_LOAD_FAILURE; } if (!(sched = ast_sched_context_create())) { ast_log(LOG_ERROR, "Could not create scheduler for contact auto-expiration\n"); unload_module(); return AST_MODULE_LOAD_FAILURE; } if (ast_sched_start_thread(sched)) { ast_log(LOG_ERROR, "Could not start scheduler thread for contact auto-expiration\n"); unload_module(); return AST_MODULE_LOAD_FAILURE; } contact_expiration_initialize_existing(); if (ast_sorcery_observer_add(ast_sip_get_sorcery(), "contact", &contact_expiration_observer)) { ast_log(LOG_ERROR, "Could not add observer for notifications about contacts for contact auto-expiration\n"); unload_module(); return AST_MODULE_LOAD_FAILURE; } return AST_MODULE_LOAD_SUCCESS; }
static int load_module(void) { CHECK_PJSIP_MODULE_LOADED(); ast_sip_register_service(&logging_module); return AST_MODULE_LOAD_SUCCESS; }
static int ami_show_registrations(struct mansession *s, const struct message *m) { int count = 0; struct ast_sip_ami ami = { .s = s, .m = m, .arg = &count, .action_id = astman_get_header(m, "ActionID"), }; astman_send_listack(s, m, "Following are Events for each Inbound " "registration", "start"); ami_registrations_endpoints(&ami); astman_send_list_complete_start(s, m, "InboundRegistrationDetailComplete", count); astman_send_list_complete_end(s); return 0; } #define AMI_SHOW_REGISTRATIONS "PJSIPShowRegistrationsInbound" static pjsip_module registrar_module = { .name = { "Registrar", 9 }, .id = -1, .priority = PJSIP_MOD_PRIORITY_APPLICATION, .on_rx_request = registrar_on_rx_request, }; static int load_module(void) { const pj_str_t STR_REGISTER = { "REGISTER", 8 }; CHECK_PJSIP_MODULE_LOADED(); if (!(serializers = ao2_container_alloc( SERIALIZER_BUCKETS, serializer_hash, serializer_cmp))) { return AST_MODULE_LOAD_DECLINE; } if (ast_sip_register_service(®istrar_module)) { return AST_MODULE_LOAD_DECLINE; } if (pjsip_endpt_add_capability(ast_sip_get_pjsip_endpoint(), NULL, PJSIP_H_ALLOW, NULL, 1, &STR_REGISTER) != PJ_SUCCESS) { ast_sip_unregister_service(®istrar_module); return AST_MODULE_LOAD_DECLINE; } ast_manager_register_xml(AMI_SHOW_REGISTRATIONS, EVENT_FLAG_SYSTEM, ami_show_registrations); return AST_MODULE_LOAD_SUCCESS; } static int unload_module(void) { ast_manager_unregister(AMI_SHOW_REGISTRATIONS); ast_sip_unregister_service(®istrar_module); ao2_cleanup(serializers); return 0; }
static int load_module(void) { CHECK_PJSIP_MODULE_LOADED(); if (ast_sip_session_register_supplement(&dlg_options_supplement)) { return AST_MODULE_LOAD_DECLINE; } return AST_MODULE_LOAD_SUCCESS; }
static int load_module(void) { CHECK_PJSIP_MODULE_LOADED(); if (ast_sip_register_outbound_authenticator(&digest_authenticator)) { return AST_MODULE_LOAD_DECLINE; } return AST_MODULE_LOAD_SUCCESS; }
static int load_module(void) { CHECK_PJSIP_MODULE_LOADED(); if (ast_sip_register_subscription_handler(&mwi_handler)) { return AST_MODULE_LOAD_DECLINE; } create_mwi_subscriptions(); return AST_MODULE_LOAD_SUCCESS; }
static int load_module(void) { CHECK_PJSIP_MODULE_LOADED(); AST_TEST_REGISTER(serialized_scheduler); AST_TEST_REGISTER(unserialized_scheduler); AST_TEST_REGISTER(scheduler_cleanup); AST_TEST_REGISTER(scheduler_cancel); AST_TEST_REGISTER(scheduler_policy); return AST_MODULE_LOAD_SUCCESS; }
static int load_module(void) { CHECK_PJSIP_MODULE_LOADED(); if (!ast_module_check("res_hep.so") || !hepv3_is_loaded()) { ast_log(AST_LOG_WARNING, "res_hep is not loaded or running; declining module load\n"); return AST_MODULE_LOAD_DECLINE; } ast_sip_register_service(&logging_module); return AST_MODULE_LOAD_SUCCESS; }
static int load_module(void) { CHECK_PJSIP_MODULE_LOADED(); if (ast_sorcery_observer_add(ast_sip_get_sorcery(), "global", &global_observer)) { ast_log(LOG_WARNING, "Unable to add global observer\n"); return AST_MODULE_LOAD_DECLINE; } check_debug(); ast_sip_register_service(&logging_module); ast_cli_register_multiple(cli_pjsip, ARRAY_LEN(cli_pjsip)); return AST_MODULE_LOAD_SUCCESS; }
static int load_module(void) { char hostname[MAXHOSTNAMELEN] = ""; CHECK_PJSIP_MODULE_LOADED(); if (!gethostname(hostname, sizeof(hostname) - 1)) { ast_verb(2, "Performing DNS resolution of local hostname '%s' to get local IPv4 and IPv6 address\n", hostname); } if (ast_sip_register_service(&multihomed_module)) { ast_log(LOG_ERROR, "Could not register multihomed module for incoming and outgoing requests\n"); return AST_MODULE_LOAD_FAILURE; } return AST_MODULE_LOAD_SUCCESS; }
static int load_module(void) { CHECK_PJSIP_MODULE_LOADED(); if (aco_info_init(¬ify_cfg)) { return AST_MODULE_LOAD_DECLINE; } aco_option_register_custom(¬ify_cfg, "^.*$", ACO_REGEX, notify_options, "", notify_option_handler, 0); if (aco_process_config(¬ify_cfg, 0)) { aco_info_destroy(¬ify_cfg); return AST_MODULE_LOAD_DECLINE; } ast_cli_register_multiple(cli_options, ARRAY_LEN(cli_options)); ast_manager_register_xml("PJSIPNotify", EVENT_FLAG_SYSTEM, manager_notify); return AST_MODULE_LOAD_SUCCESS; }
static int load_module(void) { CHECK_PJSIP_MODULE_LOADED(); pjsip_transport_register_type(PJSIP_TRANSPORT_RELIABLE, "WS", 5060, &transport_type_ws); pjsip_transport_register_type(PJSIP_TRANSPORT_RELIABLE | PJSIP_TRANSPORT_SECURE, "WSS", 5060, &transport_type_wss); if (ast_sip_register_service(&websocket_module) != PJ_SUCCESS) { return AST_MODULE_LOAD_DECLINE; } if (ast_sip_session_register_supplement(&websocket_supplement)) { ast_sip_unregister_service(&websocket_module); return AST_MODULE_LOAD_DECLINE; } if (ast_websocket_add_protocol("sip", websocket_cb)) { ast_sip_session_unregister_supplement(&websocket_supplement); ast_sip_unregister_service(&websocket_module); return AST_MODULE_LOAD_DECLINE; } return AST_MODULE_LOAD_SUCCESS; }