]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_sofia] Add basic INVITE test
authorAndrey Volk <andywolk@gmail.com>
Wed, 10 Mar 2021 17:08:20 +0000 (20:08 +0300)
committerChris Rienzo <chris@signalwire.com>
Tue, 13 Apr 2021 04:21:42 +0000 (04:21 +0000)
src/mod/endpoints/mod_sofia/test/conf/freeswitch.xml [new file with mode: 0644]
src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c

diff --git a/src/mod/endpoints/mod_sofia/test/conf/freeswitch.xml b/src/mod/endpoints/mod_sofia/test/conf/freeswitch.xml
new file mode 100644 (file)
index 0000000..c654a84
--- /dev/null
@@ -0,0 +1,102 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+  <section name="configuration" description="Various Configuration">
+    <configuration name="modules.conf" description="Modules">
+      <modules>
+        <load module="mod_console"/>
+        <load module="mod_loopback"/>
+        <load module="mod_test"/>
+        <load module="mod_dptools"/>
+        <load module="mod_dialplan_xml"/>
+      </modules>
+    </configuration>
+
+    <configuration name="console.conf" description="Console Logger">
+      <mappings>
+        <map name="all" value="console,debug,info,notice,warning,err,crit,alert"/>
+      </mappings>
+      <settings>
+        <param name="colorize" value="true"/>
+        <param name="loglevel" value="debug"/>
+      </settings>
+    </configuration>
+
+    <configuration name="timezones.conf" description="Timezones">
+      <timezones>
+          <zone name="GMT" value="GMT0" />
+      </timezones>
+    </configuration>
+
+    <configuration name="sofia.conf" description="SofiaSIP">
+      <global_settings>
+        <param name="log-level" value="9"/>
+        <param name="tracelevel" value="debug"/>
+      </global_settings>
+      <profiles>
+        <profile name="internal">
+          <gateways>
+            <gateway name="test">
+              <param name="username" value="not-used"/>
+              <param name="password" value="not-used"/>
+              <param name="proxy" value="$${local_ip_v4}:53060"/>
+              <param name="register" value="false"/>
+              <param name="retry-seconds" value="30"/>
+              <param name="dtmf-type" value="rfc2833"/>
+              <variables>
+                <variable name="rtp_secure_media"  value="false" direction="outbound"/>
+              </variables>
+            </gateway>
+          </gateways>
+
+          <domains>
+            <domain name="all" alias="false" parse="true"/>
+          </domains>
+
+          <settings>
+            <param name="debug" value="1"/>
+            <param name="shutdown-on-fail" value="true"/>
+            <param name="p-asserted-id-parse" value="verbatim"/>
+            <param name="username" value="FreeSWITCH"/>
+            <param name="user-agent-string" value="FreeSWITCH"/>
+            <param name="sip-trace" value="yes"/>
+            <param name="sip-capture" value="no"/>
+            <param name="rfc2833-pt" value="101"/>
+            <param name="sip-port" value="53060"/>
+            <param name="dialplan" value="XML"/>
+            <param name="context" value="default"/>
+            <param name="dtmf-duration" value="2000"/>
+            <param name="inbound-codec-prefs" value="PCMU"/>
+            <param name="outbound-codec-prefs" value="PCMU"/>
+            <param name="rtp-timer-name" value="soft"/>
+            <param name="local-network-acl" value="localnet.auto"/>
+            <param name="manage-presence" value="false"/>
+            <param name="inbound-codec-negotiation" value="generous"/>
+            <param name="nonce-ttl" value="60"/>
+            <param name="inbound-late-negotiation" value="true"/>
+            <param name="inbound-zrtp-passthru" value="false"/>
+            <param name="rtp-ip" value="$${local_ip_v4}"/>
+            <param name="sip-ip" value="$${local_ip_v4}"/>
+            <param name="ext-rtp-ip" value="$${local_ip_v4}"/>
+            <param name="ext-sip-ip" value="$${local_ip_v4}"/>
+            <param name="rtp-timeout-sec" value="300"/>
+            <param name="rtp-hold-timeout-sec" value="1800"/>
+            <param name="session-timeout" value="600"/>
+            <param name="minimum-session-expires" value="90"/>
+            <param name="tls" value="false"/>
+          </settings>
+        </profile>
+      </profiles>
+    </configuration>
+  </section>
+
+  <section name="dialplan" description="Regex/XML Dialplan">
+    <context name="default">
+      <extension name="park">
+        <condition field="destination_number" expression="^park$">
+          <action application="answer" data=""/>
+          <action application="park" data=""/>
+        </condition>
+      </extension>
+    </context>
+  </section>
+</document>
index e5b1baa932c0ee4bfe5372e289a7e37d248bedd1..0c03d232d1f3bef5b3638306972732bdb31a77f6 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2018, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2021, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -33,9 +33,9 @@
 #include <test/switch_test.h>
 #include "../mod_sofia.c"
 
-FST_MINCORE_BEGIN("./conf")
+FST_CORE_EX_BEGIN("./conf", SCF_VG | SCF_USE_SQL)
 
-FST_SUITE_BEGIN(switch_hash)
+FST_MODULE_BEGIN(mod_sofia, sofia)
 
 FST_SETUP_BEGIN()
 {
@@ -94,9 +94,27 @@ FST_TEST_BEGIN(test_protect_url)
 }
 FST_TEST_END()
 
-FST_SUITE_END()
+FST_TEST_BEGIN(originate_test)
+{
+       switch_core_session_t *session = NULL;
+       switch_channel_t *channel = NULL;
+       switch_status_t status;
+       switch_call_cause_t cause;
+       const char *local_ip_v4 = switch_core_get_variable("local_ip_v4");
+       status = switch_ivr_originate(NULL, &session, &cause, switch_core_sprintf(fst_pool, "{ignore_early_media=true}sofia/internal/park@%s:53060", local_ip_v4), 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL);
+       fst_requires(session);
+       fst_check(status == SWITCH_STATUS_SUCCESS);
+       channel = switch_core_session_get_channel(session);
+       fst_requires(channel);
+       switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+       switch_core_session_rwunlock(session);
+       switch_sleep(1 * 1000 * 1000);
+}
+FST_TEST_END()
+
+FST_MODULE_END()
 
-FST_MINCORE_END()
+FST_CORE_END()
 
 
 /* For Emacs: