summaryrefslogtreecommitdiffstats
path: root/src/app.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-04-04 19:52:41 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-04-04 19:52:41 +0200
commit211ad859de157c676bde6529a829e66db9fe4ff6 (patch)
tree0ca534e68b440d2ae56cf6108571e2ba47e1efea /src/app.c
parent32162fe7c80b8201ff4cb4a32632830282b2249f (diff)
sip/call/mncc: Move source/dest into the call structure
In preparation of a better show calls VTY command it is of interest to know which number has been dialed by whom. For that store the source/dest in there. MNCC: Change the talloc root context to the call and don't try to free the strings after calling the routing code SIP: Use talloc_strdup to duplicate them. Call: Add null check because the talloc_strdup of the SIP layer could have failed.
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/app.c b/src/app.c
index 47ee150..4a88b36 100644
--- a/src/app.c
+++ b/src/app.c
@@ -59,25 +59,35 @@ void app_setup(struct app_config *cfg)
cfg->mncc.conn.on_disconnect = app_mncc_disconnected;
}
-static void route_to_sip(struct call *call, const char *source, const char *dest)
+static void route_to_sip(struct call *call)
{
- if (sip_create_remote_leg(&g_app.sip.agent, call, source, dest) != 0)
+ if (sip_create_remote_leg(&g_app.sip.agent, call) != 0)
call->initial->release_call(call->initial);
}
-static void route_to_mncc(struct call *call, const char *source,
- const char *dest)
+static void route_to_mncc(struct call *call)
{
- if (mncc_create_remote_leg(&g_app.mncc.conn, call, source, dest) != 0)
+ if (mncc_create_remote_leg(&g_app.mncc.conn, call) != 0)
call->initial->release_call(call->initial);
}
void app_route_call(struct call *call, const char *source, const char *dest)
{
+
+ if (!source || !dest) {
+ LOGP(DAPP, LOGL_ERROR, "call(%u) missing source(%p)/dest(%p)\n",
+ call->id, source, dest);
+ call->initial->release_call(call->initial);
+ return;
+ }
+
+ call->source = source;
+ call->dest = dest;
+
if (call->initial->type == CALL_TYPE_MNCC)
- route_to_sip(call, source, dest);
+ route_to_sip(call);
else
- route_to_mncc(call, source, dest);
+ route_to_mncc(call);
}
const char *app_media_name(int ptmsg)