summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-03-26 16:33:15 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-03-26 16:33:15 +0100
commit989bef0875f3123681bd0d6b1fd8d7ce16fa9eec (patch)
tree74ae7cecf0018facb7bd63d04d0b42e9a5897a01
parentf9ba5612a9338417e7dc8e3953140c953cf5c274 (diff)
app: Translate payload name to IETF codec name
Convert the MNCC codec type to the IETF codec name.
-rw-r--r--src/app.c16
-rw-r--r--src/app.h2
-rw-r--r--src/sip.c7
3 files changed, 19 insertions, 6 deletions
diff --git a/src/app.c b/src/app.c
index 747625e..81b3dfc 100644
--- a/src/app.c
+++ b/src/app.c
@@ -22,6 +22,7 @@
#include "call.h"
#include "logging.h"
#include "mncc.h"
+#include "mncc_protocol.h"
void app_mncc_disconnected(struct mncc_connection *conn)
{
@@ -72,3 +73,18 @@ void app_route_call(struct call *call, const char *source, const char *dest)
call_leg_release(call->initial);
}
}
+
+const char *app_media_name(int ptmsg)
+{
+ if (ptmsg == GSM_TCHF_FRAME)
+ return "GSM";
+ if (ptmsg == GSM_TCHF_FRAME_EFR)
+ return "GSM-EFR";
+ if (ptmsg == GSM_TCHH_FRAME)
+ return "GSM-HR-08";
+ if (ptmsg == GSM_TCH_FRAME_AMR)
+ return "AMR";
+
+ LOGP(DAPP, LOGL_ERROR, "Unknown ptmsg(%d). call broken\n", ptmsg);
+ return "unknown";
+}
diff --git a/src/app.h b/src/app.h
index 6bdc118..f570d7a 100644
--- a/src/app.h
+++ b/src/app.h
@@ -29,3 +29,5 @@ void app_setup(struct app_config *cfg);
void app_route_call(struct call *call, const char *source, const char *port);
void app_mncc_disconnected(struct mncc_connection *conn);
+
+const char *app_media_name(int pt_msg);
diff --git a/src/sip.c b/src/sip.c
index 0a53e28..b5a9d5c 100644
--- a/src/sip.c
+++ b/src/sip.c
@@ -223,18 +223,13 @@ static void sip_release_call(struct call_leg *_leg)
}
}
-static const char *media_name(int ptmsg)
-{
- return "GSM";
-}
-
static int send_invite(struct sip_agent *agent, struct sip_call_leg *leg,
const char *calling_num, const char *called_num)
{
struct call_leg *other = leg->base.call->initial;
struct in_addr net = { .s_addr = ntohl(other->ip) };
- leg->wanted_codec = media_name(other->payload_msg_type);
+ leg->wanted_codec = app_media_name(other->payload_msg_type);
char *from = talloc_asprintf(leg, "sip:%s@%s",
calling_num,