app: Translate payload name to IETF codec name

Convert the MNCC codec type to the IETF codec name.
zecke/mt-mncc-call
Holger Hans Peter Freyther 7 years ago
parent f9ba5612a9
commit 989bef0875
  1. 16
      src/app.c
  2. 2
      src/app.h
  3. 7
      src/sip.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";
}

@ -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);

@ -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,

Loading…
Cancel
Save