[calls] sip: origin: Add protocol prefix if missing



commit f5cd48bd99d2236cf4a9c463caa241865559e1be
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date:   Sat Jul 17 14:55:18 2021 +0200

    sip: origin: Add protocol prefix if missing

 plugins/sip/calls-sip-origin.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/plugins/sip/calls-sip-origin.c b/plugins/sip/calls-sip-origin.c
index 1fc78308..ceac592b 100644
--- a/plugins/sip/calls-sip-origin.c
+++ b/plugins/sip/calls-sip-origin.c
@@ -287,7 +287,16 @@ dial (CallsOrigin *origin,
 
   g_debug ("Calling `%s' from origin '%s'", address, name);
 
-  add_call (CALLS_SIP_ORIGIN (origin), address, FALSE, nh);
+  /* We don't require the user to input the prefix */
+  if (!g_str_has_prefix (address, "sip:") &&
+      !g_str_has_prefix (address, "sips:")) {
+    g_autofree char * address_prefix =
+      g_strconcat (self->protocol_prefix, ":", address, NULL);
+
+    add_call (CALLS_SIP_ORIGIN (origin), address_prefix, FALSE, nh);
+  } else {
+    add_call (CALLS_SIP_ORIGIN (origin), address, FALSE, nh);
+  }
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]