Difference between revisions of "Telephone system:FreeSWITCH tricks"
m (added originate string) |
(added snippet to test callerid) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
= config snippets = | = config snippets = | ||
== dial by incoming domain == | == dial by incoming domain == | ||
− | Typically, FreeSWITCH only looks at the destination number, so <code>1200@ackspace.nl</code> is treated the same as <code>1200@illegaleshow.nl</code>. | + | Typically, FreeSWITCH only looks at the destination number, so <code>1200@ackspace.nl</code> is treated the same as <code>1200@illegaleshow.nl</code> in the public dialplan. |
This snippet routes all calls destined to either the '''illegaleshow.nl''' domain or the '''illegaleshow''' extension to ''1200'' in its own dialplan. | This snippet routes all calls destined to either the '''illegaleshow.nl''' domain or the '''illegaleshow''' extension to ''1200'' in its own dialplan. | ||
− | Note that there aren't many ''sip_to_host'' examples on the net (or the alternative ''sip_req_host'' for that matter) | + | Note that there aren't many ''sip_to_host'' examples on the net (or the less predictable alternative ''sip_req_host'' for that matter, also see [https://stackoverflow.com/questions/58947495/what-is-the-difference-between-the-invite-field-and-the-to-field-in-a-sip-invite this stackoverflow thread]): |
+ | * req or '''Request Uri''' is where the INVITE goes (he next hop address, a proxy if you will) | ||
+ | * '''To Uri''' is the actual destination to call | ||
<pre> | <pre> | ||
<extension name="Illegale show"> | <extension name="Illegale show"> | ||
Line 22: | Line 24: | ||
</extension> | </extension> | ||
</pre> | </pre> | ||
+ | |||
+ | You only need to set some DNS SRV records and you're off to go: | ||
+ | <pre> | ||
+ | _sip._tcp.illegaleshow.nl. 384 IN SRV 10 20 5060 sip.ackspace.nl. | ||
+ | _sip._udp.illegaleshow.nl. 384 IN SRV 10 20 5060 sip.ackspace.nl. | ||
+ | </pre> | ||
+ | Verify that they're active with: <code>dig -t srv _sip._tcp.illegaleshow.nl</code> | ||
== dial-string for Skinny and SIP == | == dial-string for Skinny and SIP == | ||
Line 33: | Line 42: | ||
Typical for desk phones: | Typical for desk phones: | ||
− | :<code>user_exists id | + | :<code>user_exists id 101 ackspace.nl</code> |
:''true'' | :''true'' | ||
Typical for soft-phones (SIP client): | Typical for soft-phones (SIP client): | ||
− | :<code>user_exists id | + | :<code>user_exists id slackspace ackspace.nl</code> |
:''true'' | :''true'' | ||
Number from name or number | Number from name or number | ||
− | :<code>user_data | + | :<code>user_data 101@ackspace.nl attr number-alias</code> and <code>user_data slackspace@ackspace.nl attr number-alias</code> |
− | :'' | + | :''101'' |
Name from name or number | Name from name or number | ||
− | :<code>user_data | + | :<code>user_data 101@ackspace.nl attr id</code> and <code>user_data slackspace@ackspace.nl attr id</code> |
− | :''ackspace'' | + | :''slackspace'' |
+ | |||
+ | Group call information: | ||
+ | :<code>group_call 100@ackspace.nl</code> | ||
+ | :''<nowiki>[sip_invite_domain=ackspace.nl,presence_id=slackspace@ackspace.nl]error/user_not_registered,[sip_invite_domain=ackspace.nl,presence_id=hackspace@ackspace.nl]sofia/external/sip:gw+hackspace_at_ackspace@666.666.666.666:5080;transport=udp;gw=hackspace_at_ackspace;fs_nat=yes</nowiki>'' | ||
+ | Note that for both number and name group calling, you need two identical groups. | ||
== dial-string and sofia_contact == | == dial-string and sofia_contact == | ||
Line 55: | Line 69: | ||
Note: the contact URI only works on the registered user (use a number instead of a name if the user registered numerically; it happens, see [[Fritz!Box#connecting_the_Fritz.21Box|Fritz!Box]]) | Note: the contact URI only works on the registered user (use a number instead of a name if the user registered numerically; it happens, see [[Fritz!Box#connecting_the_Fritz.21Box|Fritz!Box]]) | ||
− | You can call a user by using: <code>originate user/xopr@ackspace.nl | + | You can call a user by using: <code>originate user/xopr@ackspace.nl 09008002 xml ackspace</code> or <code>originate user/196@ackspace.nl 09008002 xml ackspace</code>. |
+ | Also, to inject variables like experimenting with [[callerid]], you can use: <code>originate {caller_id_number=31457112345}user/bergeijk@ackspace.nl xopr xml public</code> | ||
[[Category:Telephony]][[Category:Telephone snippet]][[Category:FreeSWITCH]] | [[Category:Telephony]][[Category:Telephone snippet]][[Category:FreeSWITCH]] |
Latest revision as of 10:35, 4 May 2022
This page provides a couple of tricks to ease working and debugging with FreeSWITCH
Contents
config snippets
dial by incoming domain
Typically, FreeSWITCH only looks at the destination number, so 1200@ackspace.nl
is treated the same as 1200@illegaleshow.nl
in the public dialplan.
This snippet routes all calls destined to either the illegaleshow.nl domain or the illegaleshow extension to 1200 in its own dialplan.
Note that there aren't many sip_to_host examples on the net (or the less predictable alternative sip_req_host for that matter, also see this stackoverflow thread):
- req or Request Uri is where the INVITE goes (he next hop address, a proxy if you will)
- To Uri is the actual destination to call
<extension name="Illegale show"> <condition regex="any"> <!-- sip_req_host --> <regex field="${sip_to_host}" expression="illegaleshow.nl"/> <regex field="destination_number" expression="^illegaleshow$"/> <action application="set" data="domain_name=illegaleshow.nl"/> <action application="transfer" data="1200 XML illegaleshow"/> </condition> </extension>
You only need to set some DNS SRV records and you're off to go:
_sip._tcp.illegaleshow.nl. 384 IN SRV 10 20 5060 sip.ackspace.nl. _sip._udp.illegaleshow.nl. 384 IN SRV 10 20 5060 sip.ackspace.nl.
Verify that they're active with: dig -t srv _sip._tcp.illegaleshow.nl
dial-string for Skinny and SIP
TODO: SCCP..
command line examples
You can run command line commands either as fs_cli -x "COMMAND"
or by running the command line interface fs_cli
and typing the COMMAND there
user_exists and user_data
Note that directory users have an id
and optionally, a number-alias
. Both can be used to register and check if it exists in the directory.
Typical for desk phones:
user_exists id 101 ackspace.nl
- true
Typical for soft-phones (SIP client):
user_exists id slackspace ackspace.nl
- true
Number from name or number
user_data 101@ackspace.nl attr number-alias
anduser_data slackspace@ackspace.nl attr number-alias
- 101
Name from name or number
user_data 101@ackspace.nl attr id
anduser_data slackspace@ackspace.nl attr id
- slackspace
Group call information:
group_call 100@ackspace.nl
- [sip_invite_domain=ackspace.nl,presence_id=slackspace@ackspace.nl]error/user_not_registered,[sip_invite_domain=ackspace.nl,presence_id=hackspace@ackspace.nl]sofia/external/sip:gw+hackspace_at_ackspace@666.666.666.666:5080;transport=udp;gw=hackspace_at_ackspace;fs_nat=yes
Note that for both number and name group calling, you need two identical groups.
dial-string and sofia_contact
There is a user/
endpoint that uses the user's (or more regularly, the directory domain's) dial-string value to lookup the dial string address of the dialed user. This string usually contains the sofia_contact
command:
sofia_contact ackspace@ackspace.nl
- sofia/external/sip:ackspace@123.456.789.0:9876;transport=udp;user=phone;fs_nat=yes
Note: the contact URI only works on the registered user (use a number instead of a name if the user registered numerically; it happens, see Fritz!Box)
You can call a user by using: originate user/xopr@ackspace.nl 09008002 xml ackspace
or originate user/196@ackspace.nl 09008002 xml ackspace
.
Also, to inject variables like experimenting with callerid, you can use: originate {caller_id_number=31457112345}user/bergeijk@ackspace.nl xopr xml public