static int load_module(void) { CHECK_PJSIP_MODULE_LOADED(); ast_sip_register_service(&logging_module); return AST_MODULE_LOAD_SUCCESS; }
static int load_module(void) { CHECK_PJSIP_SESSION_MODULE_LOADED(); if (ast_sip_register_service(&messaging_module) != PJ_SUCCESS) { return AST_MODULE_LOAD_DECLINE; } if (pjsip_endpt_add_capability(ast_sip_get_pjsip_endpoint(), NULL, PJSIP_H_ALLOW, NULL, 1, &pjsip_message_method.name) != PJ_SUCCESS) { ast_sip_unregister_service(&messaging_module); return AST_MODULE_LOAD_DECLINE; } if (ast_msg_tech_register(&msg_tech)) { ast_sip_unregister_service(&messaging_module); return AST_MODULE_LOAD_DECLINE; } message_serializer = ast_sip_create_serializer("pjsip/messaging"); if (!message_serializer) { ast_sip_unregister_service(&messaging_module); ast_msg_tech_unregister(&msg_tech); return AST_MODULE_LOAD_DECLINE; } ast_sip_session_register_supplement(&messaging_supplement); 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 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) { if (!hepv3_is_loaded()) { ast_log(AST_LOG_WARNING, "res_hep is disabled; 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_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) { 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) { CHECK_PJSIP_SESSION_MODULE_LOADED(); if (ast_sip_register_service(&nat_module)) { ast_log(LOG_ERROR, "Could not register NAT module for incoming and outgoing requests\n"); return AST_MODULE_LOAD_FAILURE; } if (ast_sip_session_register_supplement(&nat_supplement)) { ast_log(LOG_ERROR, "Could not register NAT session supplement for incoming and outgoing INVITE requests\n"); unload_module(); return AST_MODULE_LOAD_FAILURE; } 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) { const pj_str_t STR_REGISTER = { "REGISTER", 8 }; 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; } return AST_MODULE_LOAD_SUCCESS; }
static int load_module(void) { if (ast_sip_register_service(&messaging_module) != PJ_SUCCESS) { return AST_MODULE_LOAD_DECLINE; } if (pjsip_endpt_add_capability(ast_sip_get_pjsip_endpoint(), NULL, PJSIP_H_ALLOW, NULL, 1, &pjsip_message_method.name) != PJ_SUCCESS) { ast_sip_unregister_service(&messaging_module); return AST_MODULE_LOAD_DECLINE; } if (ast_msg_tech_register(&msg_tech)) { ast_sip_unregister_service(&messaging_module); return AST_MODULE_LOAD_DECLINE; } ast_sip_session_register_supplement(&messaging_supplement); 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; }
int ast_sip_initialize_outbound_authentication(void) { return ast_sip_register_service(&outbound_auth_mod); }
int ast_sip_initialize_distributor(void) { unidentified_requests = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_RWLOCK, 0, DEFAULT_SUSPECTS_BUCKETS, suspects_hash, NULL, suspects_compare); if (!unidentified_requests) { return -1; } dialog_associations = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_RWLOCK, 0, DIALOG_ASSOCIATIONS_BUCKETS, dialog_associations_hash, NULL, dialog_associations_cmp); if (!dialog_associations) { ast_sip_destroy_distributor(); return -1; } if (distributor_pool_setup()) { ast_sip_destroy_distributor(); return -1; } prune_context = ast_sched_context_create(); if (!prune_context) { ast_sip_destroy_distributor(); return -1; } if (ast_sched_start_thread(prune_context)) { ast_sip_destroy_distributor(); return -1; } ast_sorcery_observer_add(ast_sip_get_sorcery(), "global", &global_observer); ast_sorcery_reload_object(ast_sip_get_sorcery(), "global"); if (create_artificial_endpoint() || create_artificial_auth()) { ast_sip_destroy_distributor(); return -1; } if (ast_sip_register_service(&distributor_mod)) { ast_sip_destroy_distributor(); return -1; } if (ast_sip_register_service(&endpoint_mod)) { ast_sip_destroy_distributor(); return -1; } if (ast_sip_register_service(&auth_mod)) { ast_sip_destroy_distributor(); return -1; } unid_formatter = ao2_alloc_options(sizeof(struct ast_sip_cli_formatter_entry), NULL, AO2_ALLOC_OPT_LOCK_NOLOCK); if (!unid_formatter) { ast_sip_destroy_distributor(); ast_log(LOG_ERROR, "Unable to allocate memory for unid_formatter\n"); return -1; } unid_formatter->name = "unidentified_request"; unid_formatter->print_header = cli_unid_print_header; unid_formatter->print_body = cli_unid_print_body; unid_formatter->get_container = cli_unid_get_container; unid_formatter->iterate = cli_unid_iterate; unid_formatter->get_id = cli_unid_get_id; unid_formatter->retrieve_by_id = cli_unid_retrieve_by_id; ast_sip_register_cli_formatter(unid_formatter); ast_cli_register_multiple(cli_commands, ARRAY_LEN(cli_commands)); return 0; }