Im not experienced with Twilio, but as I see from the docu, they're expecting E.164 format which is +45... in your case.
Check out https://en.wikipedia.org/wiki/E.164

Rewrite the destination and source via regex f ex  
 <action application="set" data="effective_caller_id_number=+${outbound_caller_id_number}"/>
and
 <action application="set" data="destination_number=+${destination_number}"/>

Or just try to write to their support, problably will give you an answer, whats wrong.

Thomas

On 23 July 2015 at 09:21, Michael Nielsen <mic.niel84@gmail.com> wrote:
Hello everyone,

I'm trying to setup FreeSWITCH with Twilio - to place outbound calls.

I've created a SIP trunk in Twilio and are now trying to terminate calls via Twilio - all 10 digit calls should go this way (2 digit country code and 8 digit number - Danish numbers).

This is my twilio.xml in sip_profiles/external:

<include>
  <gateway name="Twilio-outbound">
    <param name="username" value="MY-USER"/>
    <param name="password" value="MY-PASSWORD" />
    <param name="proxy" value="MY-SIP.pstn.twilio.com"/>
    <param name="register" value="false"/>
  </gateway>
</include>

This is my 02_twilio.xml in dialplan/default/:

<include>
  <extension name="international.twilio">
    <condition field="${toll_allow}" expression="international"/>
    <condition field="destination_number" expression="^(\d{10})$">
      <action application="set" data="effective_caller_id_number=${outbound_caller_id_number}"/>
      <action application="set" data="effective_caller_id_name=${outbound_caller_id_name}"/>
      <action application="bridge" data="sofia/gateway/Twilio-outbound/$1"/>
    </condition>
  </extension>
</include>

When I try and make a call for a Danish number (for example 4512345678) I get a "Bad Request 400".

This is my FS log:

freeswitch@MY-SIP> 2015-07-23 07:19:45.745254 [NOTICE] switch_channel.c:1075 New Channel sofia/internal/4561912233@MY-SIP.MY-DOMAIN.com [4af1a50e-5145-4ad8-8b9a-499a27e9e3ec]
2015-07-23 07:19:45.905238 [INFO] mod_dialplan_xml.c:635 Processing 4561912233 <4561912233>->4512345678 in context default
2015-07-23 07:19:45.905238 [NOTICE] switch_channel.c:1075 New Channel sofia/external/4512345678 [54267cad-615c-478a-9ecc-61950a995068]
2015-07-23 07:19:45.905238 [NOTICE] sofia.c:7543 Hangup sofia/external/4512345678 [CS_CONSUME_MEDIA] [NORMAL_TEMPORARY_FAILURE]
2015-07-23 07:19:45.925245 [INFO] mod_dptools.c:3276 Originate Failed.  Cause: NORMAL_TEMPORARY_FAILURE
2015-07-23 07:19:45.925245 [NOTICE] switch_channel.c:4747 Hangup sofia/internal/4561912233@MY-SIP.MY-DOMAIN.com [CS_EXECUTE] [NORMAL_TEMPORARY_FAILURE]
2015-07-23 07:19:45.925245 [NOTICE] switch_core_session.c:1641 Session 47 (sofia/internal/4561912233@MY-SIP.MY-DOMAIN.com) Ended
2015-07-23 07:19:45.925245 [NOTICE] switch_core_session.c:1645 Close Channel sofia/internal/4561912233@MY-SIP.MY-DOMAIN.com [CS_DESTROY]
2015-07-23 07:19:45.925245 [NOTICE] switch_core_session.c:1641 Session 48 (sofia/external/4512345678) Ended
2015-07-23 07:19:45.925245 [NOTICE] switch_core_session.c:1645 Close Channel sofia/external/4512345678 [CS_DESTROY]


_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-dev mailing list
FreeSWITCH-dev@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
http://www.freeswitch.org