*** id: fc276759-2e49-417e-a0b6-38e679f826fa title: Sending an SMS from FreeSWITCH XML dialplan slug: /freeswitch/sending-an-sms x-custom: ported\_from\_readme: true tags: * 'product:freeswitch' * 'product:messaging' *** In order to send an SMS from a FreeSWITCH dialplan extension, we need to do a few things: 1. Fill out the **space\_name**, **project\_key**, **api\_token**, **signalwire\_number**, and **cellphone** channel variables. 2. Substitute all the spaces in the **sms\_body** for the url encoded equivalent of %20:\ `sms_body=${system(printf 'aleg ${uuid} is calling bleg ${bleg_uuid}' | sed -r 's/ /%20/g')}` 3. Calculate the base64 equivalent of your authorization credentials so **auth** is properly setup for curl header **append\_headers** `Authorization:'basic ${auth}'`: `auth=${system(printf '${project_key}:${api_token}' | base64 --wrap 0)` 4. Then, you have the Dialplan Extension. Dial 792 from any registered sip phone, or from bash do: **fs\_cli -x 'originate loopback/792 echo inline'**. Then, your cellphone should receive a text. Review the comments in the extension for additional notes. ```xml ``` From this example, your cellphone should receive an SMS that looks like this: `​​​​​​​aleg 0739c067-c8b3-4a1d-bc8d-76f4a7e71c55 is calling bleg 426cd62b-fbcf-4fb2-a10a-9226dff5ac5d`