freeswitch 自定义头字段

Specifying SIP Proxy With fs_path
You can route a call through a specific SIP proxy by using the "fs_path" directive. Example:
sofia/foo/[email protected];fs_path=sip:proxy.this.domain
Channel Variables

Adding Request Headers
You can add arbitrary headers to outbound SIP calls by prefixing the string 'sip_h_' to any channel variable, for example:


Note that for BYE requests, you will need to use the prefix 'sip_bye_h_' on the channel variable.
Informational Tip
While not required, you should prefix your headers with "X-" to avoid issues with interoperability with other SIP stacks.
All inbound SIP calls will install any X- headers into local variables.
This means you can easily bridge any X- header from one FreeSWITCH instance to another.
To access the header above on a 2nd box, use the channel variable ${sip_h_X-Answer}
It is important to note that the syntax ${sip_h_customer-header} can't be used to retrieve any custom header not starting with X-.
It is because Sofia only reads and puts into variables custom headers starting with X-.


Adding Response Headers
There are three types of response header prefixes that can be set:
Response header
sip_rh_
Provisional response header
sip_ph_
Bye response header
sip_bye_h_
Each prefix will exclusively add headers for their given types of requests - there is no "global" response header prefix that will add a header to all response messages.
For example:

Adding Custom Headers
For instance, you may need P-Charge-Info to append to your INVITE header, you may do as follows:
;npi=0;noa=3]]>
Then, you would see it in SIP message:
INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 5.6.7.8:5080;rport;branch=z9hG4bKyg61X9v3gUD4g
Max-Forwards: 69
From: "DJB" ;tag=XQKQ322vQF5gK
To:
Call-ID: b6c776f6-47ed-1230-0085-000f1f659e58
CSeq: 30776798 INVITE
Contact:
User-Agent: FreeSWITCH-mod_sofia/1.2.0-rc2+git~20120713T162602Z~0afd7318bd+unclean~20120713T184029Z
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO, REGISTER, REFER, NOTIFY
Supported: timer, precondition, path, replaces
Allow-Events: talk, hold, conference, refer
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 229
P-Charge-Info: ;npi=0;noa=3
X-FS-Support: update_display,send_info.
Remote-Party-ID: "DJB" ;party=calling;screen=yes;privacy=off
Strip SIP Headers
Strip SIP Headers

Additional Channel variables
Additional variables may also be set to influence the way calls are handled by sofia.
For example, contacts can be filtered by setting the 'sip_exclude_contact' variable. Example:

Or you can perform SIP Digest authorization on outgoing calls by setting sip_auth_username and sip_auth_password variables to avoid using Gateways to authenticate. Example:

Changing the SIP Contact user FreeSWITCH normally uses mod_sofia@ip:port for the internal SIP contact. To change this to foo@ip:port, there is a variable, sip_contact_user:
{sip_contact_user=foo}sofia/my_profile/[email protected];transport=tcp

你可能感兴趣的:(sip)