Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Data Structures | |
class | Registration |
Functions | |
def | build_host (config, host, section='general', port_key=None) |
def | cli_options () |
def | convert (sip, filename, non_mappings, include) |
def | create_tcp (sip, pjsip, nmapped) |
def | create_tls (sip, pjsip, nmapped) |
def | create_udp (sip, pjsip, nmapped) |
def | find_non_mapped (sections, nmapped) |
def | from_dtlsenable (key, val, section, pjsip, nmapped) |
def | from_encryption_taglen (key, val, section, pjsip, nmapped) |
def | from_host (key, val, section, pjsip, nmapped) |
def | from_mailbox (key, val, section, pjsip, nmapped) |
def | from_nat (key, val, section, pjsip, nmapped) |
def | from_progressinband (key, val, section, pjsip, nmapped) |
def | from_recordfeature (key, val, section, pjsip, nmapped) |
def | from_sendrpid (key, val, section, pjsip, nmapped) |
def | get_bind (sip, pjsip, protocol) |
def | ignore (key=None, val=None, section=None, pjsip=None, nmapped=None, type='endpoint') |
def | info (msg) |
def | map_auth (sip, pjsip, nmapped) |
def | map_peer (sip, section, pjsip, nmapped) |
def | map_registrations (sip, pjsip, nmapped) |
def | map_setvars (sip, section, pjsip, nmapped) |
def | map_system (sip, pjsip, nmapped) |
def | map_transports (sip, pjsip, nmapped) |
def | merge_codec_value (key=None, val=None, section=None, pjsip=None, nmapped=None, type='endpoint', section_to=None, key_to=None) |
def | merge_value (key=None, val=None, section=None, pjsip=None, nmapped=None, type='endpoint', section_to=None, key_to=None) |
def | non_mapped (nmapped) |
def | section_by_type (section, pjsip, type) |
some utility functions More... | |
def | set_direct_media (key, val, section, pjsip, nmapped) |
def | set_dtmfmode (key, val, section, pjsip, nmapped) |
mapping functions - define f(key, val, section) where key/val are the key/value pair to write to given section in pjsip.conf More... | |
def | set_media_encryption (key, val, section, pjsip, nmapped) |
def | set_record_off_feature (key, val, section, pjsip, nmapped) |
def | set_record_on_feature (key, val, section, pjsip, nmapped) |
def | set_timers (key, val, section, pjsip, nmapped) |
def | set_tls_cafile (val, pjsip, section, nmapped) |
def | set_tls_capath (val, pjsip, section, nmapped) |
def | set_tls_cert_file (val, pjsip, section, nmapped) |
def | set_tls_cipher (val, pjsip, section, nmapped) |
def | set_tls_private_key (val, pjsip, section, nmapped) |
def | set_tls_verifyclient (val, pjsip, section, nmapped) |
def | set_tls_verifyserver (val, pjsip, section, nmapped) |
def | set_transport_common (section, sip, pjsip, protocol, nmapped) |
def | set_value (key=None, val=None, section=None, pjsip=None, nmapped=None, type='endpoint') |
def | setup_auth (key, val, section, pjsip, nmapped) |
def | setup_ident (key, val, section, pjsip, nmapped) |
def | setup_udptl (section, pjsip, nmapped) |
def | split_hostport (addr) |
def | write_pjsip (filename, pjsip, non_mappings) |
Variables | |
non_mappings | |
list | peer_map |
pjsip | |
pjsip_filename | |
string | PREFIX = 'pjsip_' |
bool | QUIET = False |
sip = astconfigparser.MultiOrderedConfigParser() | |
sip_filename | |
def build_host | ( | config, | |
host, | |||
section = 'general' , |
|||
port_key = None |
|||
) |
Returns a string composed of a host:port. This assumes that the host may have a port as part of the initial value. The port_key overrides a port in host, see parameter 'bindport' in chan_sip.
Definition at line 289 of file sip_to_pjsip.py.
Referenced by from_host(), and get_bind().
def cli_options | ( | ) |
Parse command line options and apply them. If invalid input is given, print usage information
Definition at line 1285 of file sip_to_pjsip.py.
References len().
def convert | ( | sip, | |
filename, | |||
non_mappings, | |||
include | |||
) |
Entry point for configuration file conversion. This function will create a pjsip.conf object and begin to map specific sections from sip.conf into it. Returns the new pjsip.conf object once completed
Definition at line 1229 of file sip_to_pjsip.py.
References convert(), find_non_mapped(), map_auth(), map_peer(), map_registrations(), map_setvars(), map_system(), map_transports(), and non_mapped().
Referenced by convert().
def create_tcp | ( | sip, | |
pjsip, | |||
nmapped | |||
) |
Creates a 'transport-tcp' section in the pjsip.conf file based on the following settings from sip.conf: tcpenable tcpbindaddr (or bindaddr)
Definition at line 745 of file sip_to_pjsip.py.
References get_bind(), set_transport_common(), and set_value().
Referenced by map_transports().
def create_tls | ( | sip, | |
pjsip, | |||
nmapped | |||
) |
Creates a 'transport-tls' section in pjsip.conf based on the following settings from sip.conf: tlsenable (or sslenable) tlsbindaddr (or sslbindaddr or bindaddr) tlsprivatekey (or sslprivatekey) tlscipher (or sslcipher) tlscafile tlscapath (or tlscadir) tlscertfile (or sslcert or tlscert) tlsverifyclient tlsdontverifyserver tlsclientmethod (or sslclientmethod)
Definition at line 814 of file sip_to_pjsip.py.
References get_bind(), set_transport_common(), and set_value().
Referenced by map_transports().
def create_udp | ( | sip, | |
pjsip, | |||
nmapped | |||
) |
Creates a 'transport-udp' section in the pjsip.conf file based on the following settings from sip.conf: bindaddr (or udpbindaddr) bindport
Definition at line 729 of file sip_to_pjsip.py.
References get_bind(), set_transport_common(), and set_value().
Referenced by map_transports().
def find_non_mapped | ( | sections, | |
nmapped | |||
) |
Determine sip.conf options that were not properly mapped to pjsip.conf options.
Definition at line 1165 of file sip_to_pjsip.py.
Referenced by convert().
def from_dtlsenable | ( | key, | |
val, | |||
section, | |||
pjsip, | |||
nmapped | |||
) |
Optionally sets media_encryption=dtls based on sip.conf dtlsenable
Definition at line 441 of file sip_to_pjsip.py.
References set_value().
def from_encryption_taglen | ( | key, | |
val, | |||
section, | |||
pjsip, | |||
nmapped | |||
) |
Sets the srtp_tag32 option based on sip.conf encryption_taglen
Definition at line 435 of file sip_to_pjsip.py.
References set_value().
def from_host | ( | key, | |
val, | |||
section, | |||
pjsip, | |||
nmapped | |||
) |
Sets contact info in an AOR section in pjsip.conf using 'host' and 'port' data from sip.conf
Definition at line 327 of file sip_to_pjsip.py.
References build_host(), and set_value().
def from_mailbox | ( | key, | |
val, | |||
section, | |||
pjsip, | |||
nmapped | |||
) |
Determines whether a mailbox configured in sip.conf should map to an endpoint or aor in pjsip.conf. If subscribemwi is true, then the mailboxes are set on an aor. Otherwise the mailboxes are set on the endpoint.
Definition at line 360 of file sip_to_pjsip.py.
References set_value().
Referenced by ast_vm_msg_forward(), forward_message_from_mailbox(), manager_voicemail_forward(), and vm_msg_forward().
def from_nat | ( | key, | |
val, | |||
section, | |||
pjsip, | |||
nmapped | |||
) |
Sets values from nat into the appropriate pjsip.conf options.
Definition at line 191 of file sip_to_pjsip.py.
References set_value().
def from_progressinband | ( | key, | |
val, | |||
section, | |||
pjsip, | |||
nmapped | |||
) |
Sets the inband_progress value in pjsip.conf
Definition at line 281 of file sip_to_pjsip.py.
References set_value().
def from_recordfeature | ( | key, | |
val, | |||
section, | |||
pjsip, | |||
nmapped | |||
) |
If record on/off feature is set to automixmon then set one_touch_recording, otherwise it can't be mapped.
Definition at line 265 of file sip_to_pjsip.py.
References set_value().
Referenced by set_record_off_feature(), and set_record_on_feature().
def from_sendrpid | ( | key, | |
val, | |||
section, | |||
pjsip, | |||
nmapped | |||
) |
Sets the send_rpid/pai values in pjsip.conf.
Definition at line 243 of file sip_to_pjsip.py.
References set_value().
def get_bind | ( | sip, | |
pjsip, | |||
protocol | |||
) |
Given the protocol (udp, tcp, or tls), return - the bind address, like [::] or 0.0.0.0 - name of the section to be created
Definition at line 664 of file sip_to_pjsip.py.
References build_host(), split_hostport(), and str.
Referenced by create_tcp(), create_tls(), and create_udp().
def ignore | ( | key = None , |
|
val = None , |
|||
section = None , |
|||
pjsip = None , |
|||
nmapped = None , |
|||
type = 'endpoint' |
|||
) |
Ignore a key and mark it as mapped
Definition at line 47 of file sip_to_pjsip.py.
Referenced by acl_handler(), endpoint_acl_handler(), find_unused_payload(), find_unused_payload_in_range(), rtp_codecs_assign_payload_code_rx(), tear_down_invocation_test(), and verification_apply().
def info | ( | msg | ) |
Definition at line 1313 of file sip_to_pjsip.py.
Referenced by __aco_option_register(), __ast_datastore_alloc(), __hash_open(), _jb_get(), acf_curl_exec(), acf_version_exec(), aco_info_destroy(), aco_info_init(), aco_option_register_deprecated(), aco_pending_config(), aco_process_ast_config(), aco_process_config(), add_media_cb(), alloc_notify_task_data(), alloc_variant(), ami_outbound_registration_task(), apply_config(), ast_build_timing(), ast_channel_datastore_find(), ast_datastores_alloc_datastore(), ast_localtime_wakeup_monitor(), ast_media_get_variants(), ast_module_register(), ast_module_reload(), ast_module_unregister(), ast_res_pjsip_initialize_configuration(), ast_sip_publish_client_alloc_datastore(), ast_sip_session_alloc_datastore(), ast_sip_subscription_alloc_datastore(), AST_TEST_DEFINE(), astman_datastore_find(), asyncgoto_exec(), build_ami_notify(), build_cli_notify(), capture_info_dtor(), cdr_object_update_party_b_userfield_cb(), cdr_read_callback(), chanavail_exec(), complete_config_option(), complete_config_type(), conf_exec(), create_sound_blob(), dbm_open(), device_state_info_dt(), digest_lookup(), dumpchan_exec(), execute_state_callback(), exten_state_pub_data_alloc(), exten_state_publisher_state_cb(), extension_state_cb(), find_transcoders(), find_variant(), get_device_state_causing_channels(), handle_cli_agi_show(), handle_cli_refresh(), handle_client_registration(), handle_client_state_destruction(), handle_registration_response(), handle_show_function(), hcreate(), hepv3_create_capture_info(), info_configuration_destroy(), init_hash(), init_info_configuration(), internal_process_ast_config(), jingle_send_session_info(), link_option_to_types(), manager_state_cb(), media_info_alloc(), media_info_destroy(), method_logging_info_alloc(), notify_ami_channel_data_create(), notify_ami_channel_data_destroy(), notify_ami_data_create(), notify_ami_data_destroy(), notify_ami_uri_data_create(), notify_ami_uri_data_destroy(), notify_cli_channel_data_create(), notify_cli_data_create(), notify_cli_uri_data_create(), parking_is_exten_park(), process_category(), push_notify(), push_notify_channel(), push_notify_uri(), refresh_list(), reregister_immediately_cb(), res_sdp_crypto_parse_offer(), rtp_learning_rtp_seq_update(), rtp_learning_seq_init(), schedule_registration(), start_resource(), state_changed(), transport_state_callback(), and unregister_task().
def map_auth | ( | sip, | |
pjsip, | |||
nmapped | |||
) |
Creates auth sections based on entries in the authentication section of sip.conf. pjsip.conf section names consist of "auth_" followed by the name of the realm.
Definition at line 912 of file sip_to_pjsip.py.
References set_value().
Referenced by convert().
def map_peer | ( | sip, | |
section, | |||
pjsip, | |||
nmapped | |||
) |
Map the options from a peer section in sip.conf into the appropriate sections in pjsip.conf
Definition at line 1149 of file sip_to_pjsip.py.
References setup_udptl().
Referenced by convert().
def map_registrations | ( | sip, | |
pjsip, | |||
nmapped | |||
) |
Gathers all necessary outbound registration data in sip.conf and creates corresponding registration sections in pjsip.conf
Definition at line 1106 of file sip_to_pjsip.py.
Referenced by convert().
def map_setvars | ( | sip, | |
section, | |||
pjsip, | |||
nmapped | |||
) |
Map all setvar in peer section to the appropriate endpoint set_var
Definition at line 1136 of file sip_to_pjsip.py.
References set_value().
Referenced by convert().
def map_system | ( | sip, | |
pjsip, | |||
nmapped | |||
) |
Definition at line 1187 of file sip_to_pjsip.py.
References set_value().
Referenced by convert().
def map_transports | ( | sip, | |
pjsip, | |||
nmapped | |||
) |
Finds options in sip.conf general section pertaining to transport configuration and creates appropriate transport configuration sections in pjsip.conf. sip.conf only allows a single UDP transport, TCP transport, and TLS transport for each IP version. As such, the mapping into PJSIP can be made consistent by defining six sections: transport-udp6 transport-udp transport-tcp6 transport-tcp transport-tls6 transport-tls To accommodate the default behaviors in sip.conf, we'll need to create the UDP transports first, followed by the TCP and TLS transports.
Definition at line 879 of file sip_to_pjsip.py.
References create_tcp(), create_tls(), and create_udp().
Referenced by convert().
def merge_codec_value | ( | key = None , |
|
val = None , |
|||
section = None , |
|||
pjsip = None , |
|||
nmapped = None , |
|||
type = 'endpoint' , |
|||
section_to = None , |
|||
key_to = None |
|||
) |
Merge values from allow/deny with those from the default. Special treatment for all
Definition at line 91 of file sip_to_pjsip.py.
References merge_codec_value(), merge_value(), and set_value().
Referenced by merge_codec_value().
def merge_value | ( | key = None , |
|
val = None , |
|||
section = None , |
|||
pjsip = None , |
|||
nmapped = None , |
|||
type = 'endpoint' , |
|||
section_to = None , |
|||
key_to = None |
|||
) |
Merge values from the given section with those from the default.
Definition at line 68 of file sip_to_pjsip.py.
References merge_value(), and set_value().
Referenced by merge_codec_value(), merge_value(), and set_transport_common().
def non_mapped | ( | nmapped | ) |
Write non-mapped sip.conf values to the non-mapped object
Definition at line 132 of file sip_to_pjsip.py.
Referenced by convert().
def section_by_type | ( | section, | |
pjsip, | |||
type | |||
) |
some utility functions
Finds a section based upon the given type, adding it if not found.
Definition at line 23 of file sip_to_pjsip.py.
def set_direct_media | ( | key, | |
val, | |||
section, | |||
pjsip, | |||
nmapped | |||
) |
Maps values from the sip.conf comma separated direct_media option into pjsip.conf direct_media options.
Definition at line 224 of file sip_to_pjsip.py.
References set_value().
def set_dtmfmode | ( | key, | |
val, | |||
section, | |||
pjsip, | |||
nmapped | |||
) |
mapping functions - define f(key, val, section) where key/val are the key/value pair to write to given section in pjsip.conf
Sets the dtmfmode value. If value matches allowable option in pjsip then map it, otherwise set it to none.
Definition at line 154 of file sip_to_pjsip.py.
References set_value().
def set_media_encryption | ( | key, | |
val, | |||
section, | |||
pjsip, | |||
nmapped | |||
) |
Sets the media_encryption value in pjsip.conf
Definition at line 251 of file sip_to_pjsip.py.
References set_value().
def set_record_off_feature | ( | key, | |
val, | |||
section, | |||
pjsip, | |||
nmapped | |||
) |
Sets the record_off_feature in pjsip.conf
Definition at line 277 of file sip_to_pjsip.py.
References from_recordfeature().
def set_record_on_feature | ( | key, | |
val, | |||
section, | |||
pjsip, | |||
nmapped | |||
) |
Sets the record_on_feature in pjsip.conf
Definition at line 273 of file sip_to_pjsip.py.
References from_recordfeature().
def set_timers | ( | key, | |
val, | |||
section, | |||
pjsip, | |||
nmapped | |||
) |
Sets the timers in pjsip.conf from the session-timers option found in sip.conf.
Definition at line 205 of file sip_to_pjsip.py.
References set_value().
def set_tls_cafile | ( | val, | |
pjsip, | |||
section, | |||
nmapped | |||
) |
Sets ca_list_file based on sip.conf tlscafile
Definition at line 785 of file sip_to_pjsip.py.
References set_value().
def set_tls_capath | ( | val, | |
pjsip, | |||
section, | |||
nmapped | |||
) |
Sets ca_list_path based on sip.conf tlscapath
Definition at line 791 of file sip_to_pjsip.py.
References set_value().
def set_tls_cert_file | ( | val, | |
pjsip, | |||
section, | |||
nmapped | |||
) |
Sets cert_file based on sip.conf tlscertfile
Definition at line 763 of file sip_to_pjsip.py.
References set_value().
def set_tls_cipher | ( | val, | |
pjsip, | |||
section, | |||
nmapped | |||
) |
Sets cipher based on sip.conf tlscipher or sslcipher
Definition at line 775 of file sip_to_pjsip.py.
References set_value().
def set_tls_private_key | ( | val, | |
pjsip, | |||
section, | |||
nmapped | |||
) |
Sets privkey_file based on sip.conf tlsprivatekey or sslprivatekey
Definition at line 769 of file sip_to_pjsip.py.
References set_value().
def set_tls_verifyclient | ( | val, | |
pjsip, | |||
section, | |||
nmapped | |||
) |
Sets verify_client based on sip.conf tlsverifyclient
Definition at line 797 of file sip_to_pjsip.py.
References set_value().
def set_tls_verifyserver | ( | val, | |
pjsip, | |||
section, | |||
nmapped | |||
) |
Sets verify_server based on sip.conf tlsdontverifyserver
Definition at line 803 of file sip_to_pjsip.py.
References set_value().
def set_transport_common | ( | section, | |
sip, | |||
pjsip, | |||
protocol, | |||
nmapped | |||
) |
sip.conf has several global settings that in pjsip.conf apply to individual transports. This function adds these global settings to each individual transport. The settings included are: externaddr (or externip) externhost externtcpport for TCP externtlsport for TLS localnet tos_sip cos_sip
Definition at line 611 of file sip_to_pjsip.py.
References merge_value(), set_value(), and split_hostport().
Referenced by create_tcp(), create_tls(), and create_udp().
def set_value | ( | key = None , |
|
val = None , |
|||
section = None , |
|||
pjsip = None , |
|||
nmapped = None , |
|||
type = 'endpoint' |
|||
) |
Sets the key to the value within the section in pjsip.conf
Definition at line 52 of file sip_to_pjsip.py.
Referenced by create_tcp(), create_tls(), create_udp(), from_dtlsenable(), from_encryption_taglen(), from_host(), from_mailbox(), from_nat(), from_progressinband(), from_recordfeature(), from_sendrpid(), map_auth(), map_setvars(), map_system(), merge_codec_value(), merge_value(), set_direct_media(), set_dtmfmode(), set_media_encryption(), set_timers(), set_tls_cafile(), set_tls_capath(), set_tls_cert_file(), set_tls_cipher(), set_tls_private_key(), set_tls_verifyclient(), set_tls_verifyserver(), set_transport_common(), setup_auth(), setup_ident(), setup_udptl(), and Registration.write().
def setup_auth | ( | key, | |
val, | |||
section, | |||
pjsip, | |||
nmapped | |||
) |
Sets up authentication information for a specific endpoint based on the 'secret' setting on a peer in sip.conf
Definition at line 378 of file sip_to_pjsip.py.
References set_value().
def setup_ident | ( | key, | |
val, | |||
section, | |||
pjsip, | |||
nmapped | |||
) |
Examines the 'type' field for a sip.conf peer and creates an identify section if the type is either 'peer' or 'friend'. The identify section uses either the host or defaultip field of the sip.conf peer.
Definition at line 411 of file sip_to_pjsip.py.
References set_value().
def setup_udptl | ( | section, | |
pjsip, | |||
nmapped | |||
) |
Sets values from udptl into the appropriate pjsip.conf options.
Definition at line 170 of file sip_to_pjsip.py.
References set_value().
Referenced by map_peer().
def split_hostport | ( | addr | ) |
Given an address in the form 'host:port' separate the host and port components. Returns a two-tuple of strings, (host, port). If no port is present in the string, then the port section of the tuple is None.
Definition at line 590 of file sip_to_pjsip.py.
Referenced by get_bind(), load_module(), set_transport_common(), and unload_module().
def write_pjsip | ( | filename, | |
pjsip, | |||
non_mappings | |||
) |
Write pjsip.conf file to disk
Definition at line 1261 of file sip_to_pjsip.py.
References astconfigparser.write_dicts().
non_mappings |
Definition at line 1328 of file sip_to_pjsip.py.
list peer_map |
Definition at line 452 of file sip_to_pjsip.py.
pjsip |
Definition at line 1328 of file sip_to_pjsip.py.
pjsip_filename |
Definition at line 1320 of file sip_to_pjsip.py.
string PREFIX = 'pjsip_' |
Definition at line 15 of file sip_to_pjsip.py.
bool QUIET = False |
Definition at line 16 of file sip_to_pjsip.py.
Definition at line 1322 of file sip_to_pjsip.py.
sip_filename |
Definition at line 1320 of file sip_to_pjsip.py.