Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
core-cookbook:devel [2009/04/03 14:21] 212.227.35.68 |
core-cookbook:devel [2012/03/19 09:07] (current) 85.178.69.42 |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== SIP Router: Core Cookbook ====== | ====== SIP Router: Core Cookbook ====== | ||
- | This tutorial collects the functions and parameters exported by SIP Router core to configuration file. | + | **This page has been moved to [[cookbooks: |
- | ===== Core Keywords ===== | ||
- | Keywords specific to SIP messages which can be used mainly in ''' | ||
- | |||
- | ==== af ==== | ||
- | |||
- | The address family of the received SIP message. It is INET if the message was received over IPv4 or INET6 if the message was received over IPv6. | ||
- | |||
- | Exampe of usage: | ||
- | |||
- | <code c> | ||
- | if (af==INET6) { | ||
- | log(" | ||
- | } | ||
- | </ | ||
- | |||
- | ==== dst_ip ==== | ||
- | |||
- | The IP of the local interface where the SIP message was received. When the proxy listens on many network interfaces, makes possible to detect which was the one that received the packet. | ||
- | |||
- | Example of usage: | ||
- | |||
- | < | ||
- | | ||
- | log(" | ||
- | }; | ||
- | </ | ||
- | |||
- | ==== dst_port ==== | ||
- | |||
- | The local port where the SIP packet was received. When SIP-Router is listening on many ports, it is useful to learn which was the one that received the SIP packet. | ||
- | |||
- | Example of usage: | ||
- | < | ||
- | | ||
- | { | ||
- | | ||
- | }; | ||
- | </ | ||
- | |||
- | |||
- | ==== from_uri ==== | ||
- | |||
- | This script variable is a reference to the URI of ' | ||
- | |||
- | Example of usage: | ||
- | |||
- | < | ||
- | if(is_method(" | ||
- | { | ||
- | log(" | ||
- | }; | ||
- | </ | ||
- | |||
- | ==== method ==== | ||
- | |||
- | The variable is a reference to the SIP method of the message. | ||
- | |||
- | Example of usage: | ||
- | |||
- | < | ||
- | if(method==" | ||
- | { | ||
- | | ||
- | }; | ||
- | </ | ||
- | |||
- | ==== msg:len ==== | ||
- | |||
- | The variable is a reference to the size of the message. It can be used in ' | ||
- | |||
- | |||
- | Example of usage: | ||
- | < | ||
- | if(msg: | ||
- | { | ||
- | sl_send_reply(" | ||
- | exit; | ||
- | }; | ||
- | </ | ||
- | |||
- | |||
- | . | ||
- | |||
- | ==== proto ==== | ||
- | |||
- | This variable can be used to test the transport protocol of the SIP message. | ||
- | |||
- | Example of usage: | ||
- | < | ||
- | if(proto==UDP) | ||
- | { | ||
- | log(" | ||
- | }; | ||
- | </ | ||
- | |||
- | ==== status ==== | ||
- | |||
- | If used in onreply_route, | ||
- | |||
- | Example of usage: | ||
- | < | ||
- | if(status==" | ||
- | { | ||
- | log(" | ||
- | }; | ||
- | </ | ||
- | |||
- | ==== src_ip ==== | ||
- | |||
- | Reference to source IP address of the SIP message. | ||
- | |||
- | Example of usage: | ||
- | < | ||
- | if(src_ip==127.0.0.1) | ||
- | { | ||
- | log(" | ||
- | }; | ||
- | </ | ||
- | |||
- | ==== src_port ==== | ||
- | |||
- | Reference to source port of the SIP message (from which port the message was sent by previous hop). | ||
- | |||
- | Example of usage: | ||
- | < | ||
- | if(src_port==5061) | ||
- | { | ||
- | log(" | ||
- | } | ||
- | </ | ||
- | |||
- | ==== to_uri ==== | ||
- | |||
- | This variable can be used to test the value of URI from To header. | ||
- | |||
- | Example of usage: | ||
- | < | ||
- | if(to_uri=~" | ||
- | { | ||
- | log(" | ||
- | }; | ||
- | </ | ||
- | |||
- | ==== uri ==== | ||
- | |||
- | |||
- | This variable can be used to test the value of the request URI. | ||
- | |||
- | Example of usage: | ||
- | < | ||
- | if(uri=~" | ||
- | { | ||
- | log(" | ||
- | }; | ||
- | </ | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | ===== Core Values ===== | ||
- | |||
- | Values that can be used in ''' | ||
- | |||
- | ==== INET ==== | ||
- | |||
- | This keyword can be used to test whether the SIP packet was received over an IPv4 connection. | ||
- | |||
- | Example of usage: | ||
- | |||
- | < | ||
- | if (af==INET) { | ||
- | log(" | ||
- | } | ||
- | </ | ||
- | |||
- | ==== INET6 ==== | ||
- | |||
- | This keyword can be used to test whether the SIP packet was received over an IPv6 connection. | ||
- | |||
- | Example of usage: | ||
- | < | ||
- | if(af==INET6) | ||
- | { | ||
- | log(" | ||
- | }; | ||
- | </ | ||
- | |||
- | ==== TCP ==== | ||
- | |||
- | This keyword can be used to test the value of ' | ||
- | |||
- | Example of usage: | ||
- | < | ||
- | if(proto==TCP) | ||
- | { | ||
- | log(" | ||
- | }; | ||
- | </ | ||
- | |||
- | ==== UDP ==== | ||
- | |||
- | This keyword can be used to test the value of ' | ||
- | |||
- | Example of usage: | ||
- | < | ||
- | if(proto==UDP) | ||
- | { | ||
- | log(" | ||
- | }; | ||
- | </ | ||
- | |||
- | ==== max_len ==== | ||
- | |||
- | This keyword is set to the maximum size of an UDP packet. It can be used to test message' | ||
- | |||
- | Example of usage: | ||
- | < | ||
- | if(msg: | ||
- | { | ||
- | sl_send_reply(" | ||
- | exit; | ||
- | } | ||
- | </ | ||
- | |||
- | |||
- | ==== myself ==== | ||
- | |||
- | It is a reference to the list of local IP addresses, hostnames and aliases that has been set in SIP-Router configuration file. This lists contain the domains served by SIP-Router. | ||
- | |||
- | The variable can be used to test if the host part of an URI is in the list. The usefulness of this test is to select the messages that has to be processed locally or has to be forwarded to another server. | ||
- | |||
- | See " | ||
- | |||
- | Example of usage: | ||
- | < | ||
- | if(uri==myself) { | ||
- | log(" | ||
- | }; | ||
- | </ | ||
- | |||
- | |||
- | ==== null ==== | ||
- | |||
- | Can be used in assignment to reset the value of a per-script variable or to delete an avp. | ||
- | |||
- | Example of usage: | ||
- | < | ||
- | $avp(i:12) = null; | ||
- | $var(x) = null; | ||
- | </ | ||
- | |||
- | ===== Core parameters ===== | ||
- | |||
- | ==== advertised_address ==== | ||
- | |||
- | ==== advertised_port ==== | ||
- | |||
- | ==== alias ==== | ||
- | |||
- | ==== check_via ==== | ||
- | |||
- | ==== children ==== | ||
- | |||
- | ==== chroot ==== | ||
- | |||
- | ==== debug ==== | ||
- | |||
- | ==== description|descr|desc ==== | ||
- | |||
- | ==== disable_core_dump ==== | ||
- | |||
- | ==== disable_sctp ==== | ||
- | |||
- | ==== disable_tcp ==== | ||
- | |||
- | ==== disable_tls|tls_disable ==== | ||
- | |||
- | ==== dns ==== | ||
- | |||
- | ==== dns_cache_del_nonexp|dns_cache_delete_nonexpired ==== | ||
- | |||
- | ==== dns_cache_flags ==== | ||
- | |||
- | ==== dns_cache_gc_interval ==== | ||
- | |||
- | ==== dns_cache_init ==== | ||
- | |||
- | ==== dns_cache_max_ttl ==== | ||
- | |||
- | ==== dns_cache_mem ==== | ||
- | |||
- | ==== dns_cache_min_ttl ==== | ||
- | |||
- | ==== dns_cache_negative_ttl ==== | ||
- | |||
- | ==== dns_retr_no ==== | ||
- | |||
- | ==== dns_retr_time ==== | ||
- | |||
- | ==== dns_sctp_pref|dns_sctp_preference ==== | ||
- | |||
- | ==== dns_search_full_match ==== | ||
- | |||
- | ==== dns_servers_no ==== | ||
- | |||
- | ==== dns_srv_lb|dns_srv_loadbalancing ==== | ||
- | |||
- | ==== dns_tcp_pref|dns_tcp_preference ==== | ||
- | |||
- | ==== dns_tls_pref|dns_tls_preference ==== | ||
- | |||
- | ==== dns_try_ipv6 ==== | ||
- | |||
- | ==== dns_try_naptr ==== | ||
- | |||
- | ==== dns_udp_pref|dns_udp_preference ==== | ||
- | |||
- | ==== dns_use_search_list ==== | ||
- | |||
- | ==== dst_blacklist_expire|dst_blacklist_ttl ==== | ||
- | |||
- | ==== dst_blacklist_gc_interval ==== | ||
- | |||
- | ==== dst_blacklist_init ==== | ||
- | |||
- | ==== dst_blacklist_mem ==== | ||
- | |||
- | ==== enable_sctp ==== | ||
- | |||
- | ==== enable_tls|tls_enable ==== | ||
- | |||
- | ==== exit_timeout|ser_kill_timeout ==== | ||
- | |||
- | ==== fork ==== | ||
- | |||
- | ==== group|gid ==== | ||
- | |||
- | ==== listen ==== | ||
- | |||
- | ==== loadmodule ==== | ||
- | ==== loadpath ==== | ||
- | |||
- | Set the module search path. This can be used to simplify the loadmodule parameter. | ||
- | Example of usage: | ||
- | |||
- | loadpath "/ | ||
- | loadmodule " | ||
- | loadmodule " | ||
- | loadmodule " | ||
- | loadmodule " | ||
- | loadmodule " | ||
- | |||
- | ==== log_facility ==== | ||
- | |||
- | ==== log_stderror ==== | ||
- | |||
- | ==== maxbuffer ==== | ||
- | |||
- | ==== max_while_loops ==== | ||
- | |||
- | ==== mcast_loopback ==== | ||
- | |||
- | ==== mcast_ttl ==== | ||
- | |||
- | ==== memdbg|mem_dbg ==== | ||
- | |||
- | ==== memlog|mem_log ==== | ||
- | |||
- | ==== mhomed ==== | ||
- | |||
- | ==== mlock_pages ==== | ||
- | |||
- | ==== modparam ==== | ||
- | |||
- | ==== open_files_limit ==== | ||
- | |||
- | ==== phone2tel ==== | ||
- | |||
- | ==== pmtu_discovery ==== | ||
- | |||
- | ==== port ==== | ||
- | |||
- | ==== real_time ==== | ||
- | |||
- | ==== reply_to_via ==== | ||
- | |||
- | ==== rev_dns ==== | ||
- | |||
- | ==== rt_policy ==== | ||
- | |||
- | ==== rt_prio ==== | ||
- | |||
- | ==== rt_timer1_policy|rt_ftimer_policy ==== | ||
- | |||
- | ==== rt_timer1_prio|rt_fast_timer_prio|rt_ftimer_prio ==== | ||
- | |||
- | ==== rt_timer2_policy|rt_stimer_policy ==== | ||
- | |||
- | ==== rt_timer2_prio|rt_stimer_prio ==== | ||
- | |||
- | ==== sctp_autoclose ==== | ||
- | |||
- | ==== sctp_children ==== | ||
- | |||
- | ==== sctp_send_retries ==== | ||
- | |||
- | ==== sctp_send_ttl ==== | ||
- | |||
- | ==== sctp_socket_rcvbuf|sctp_socket_receive_buffer ==== | ||
- | |||
- | ==== sctp_socket_sndbuf|sctp_socket_send_buffer ==== | ||
- | |||
- | ==== server_id ==== | ||
- | |||
- | ==== server_signature ==== | ||
- | |||
- | ==== shm_force_alloc ==== | ||
- | |||
- | ==== sip_warning ==== | ||
- | |||
- | ==== statistics ==== | ||
- | |||
- | ==== stun_allow_fp ==== | ||
- | |||
- | ==== stun_allow_stun ==== | ||
- | |||
- | ==== stun_refresh_interval ==== | ||
- | |||
- | ==== syn_branch ==== | ||
- | |||
- | ==== tcp_accept_aliases ==== | ||
- | |||
- | ==== tcp_buf_write|tcp_async ==== | ||
- | |||
- | ==== tcp_children ==== | ||
- | |||
- | ==== tcp_connection_lifetime ==== | ||
- | |||
- | ==== tcp_connect_timeout ==== | ||
- | |||
- | ==== tcp_conn_wq_max ==== | ||
- | |||
- | ==== tcp_crlf_ping ==== | ||
- | |||
- | ==== tcp_defer_accept ==== | ||
- | |||
- | ==== tcp_delayed_ack ==== | ||
- | |||
- | ==== tcp_fd_cache ==== | ||
- | |||
- | ==== tcp_keepalive ==== | ||
- | |||
- | ==== tcp_keepcnt ==== | ||
- | |||
- | ==== tcp_keepidle ==== | ||
- | |||
- | ==== tcp_keepintvl ==== | ||
- | |||
- | ==== tcp_linger2 ==== | ||
- | |||
- | ==== tcp_max_connections ==== | ||
- | |||
- | ==== tcp_no_connect ==== | ||
- | |||
- | ==== tcp_poll_method ==== | ||
- | |||
- | ==== tcp_send_timeout ==== | ||
- | |||
- | ==== tcp_source_ipv4 ==== | ||
- | |||
- | ==== tcp_source_ipv6 ==== | ||
- | |||
- | ==== tcp_syncnt ==== | ||
- | |||
- | ==== tcp_wq_max ==== | ||
- | |||
- | ==== tls_ca_list ==== | ||
- | |||
- | ==== tls_certificate ==== | ||
- | |||
- | ==== tls_handshake_timeout ==== | ||
- | |||
- | ==== tlslog|tls_log ==== | ||
- | |||
- | ==== tls_method ==== | ||
- | |||
- | ==== tls_port_no ==== | ||
- | |||
- | ==== tls_private_key ==== | ||
- | |||
- | ==== tls_require_certificate ==== | ||
- | |||
- | ==== tls_send_timeout ==== | ||
- | |||
- | ==== tls_verify ==== | ||
- | |||
- | ==== tos ==== | ||
- | |||
- | ==== use_dns_cache ==== | ||
- | |||
- | ==== use_dns_failover ==== | ||
- | |||
- | ==== use_dst_blacklist ==== | ||
- | |||
- | ==== user|uid ==== | ||
- | |||
- | ==== workdir|wdir ==== | ||
- | |||
- | ===== Core functions ===== | ||
- | |||
- | ===== Routing blocks ===== | ||
- | |||
- | ===== Script statements ===== | ||
- | |||
- | ===== Script operations ===== |