From 9bdcc9ca75a55c5d5bc5b7589e410c39b714c0c3 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 31 Mar 2010 06:39:35 +0200 Subject: [PATCH] [mgcp] Add some parsing for RSIP messages coming in This will just call a callback and leave all the handling to the application. --- openbsc/include/openbsc/mgcp.h | 2 ++ openbsc/src/mgcp/mgcp_protocol.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/openbsc/include/openbsc/mgcp.h b/openbsc/include/openbsc/mgcp.h index 6a07cd111..37194bee8 100644 --- a/openbsc/include/openbsc/mgcp.h +++ b/openbsc/include/openbsc/mgcp.h @@ -77,6 +77,7 @@ struct mgcp_config; typedef int (*mgcp_change)(struct mgcp_config *cfg, int endpoint, int state, int local_rtp); typedef int (*mgcp_policy)(struct mgcp_config *cfg, int endpoint, int state, const char *transactio_id); +typedef int (*mgcp_reset)(struct mgcp_config *cfg); struct mgcp_config { int source_port; @@ -97,6 +98,7 @@ struct mgcp_config { mgcp_change change_cb; mgcp_policy policy_cb; + mgcp_reset reset_cb; void *data; struct mgcp_endpoint *endpoints; diff --git a/openbsc/src/mgcp/mgcp_protocol.c b/openbsc/src/mgcp/mgcp_protocol.c index 7ad4e0a1f..b8c011e08 100644 --- a/openbsc/src/mgcp/mgcp_protocol.c +++ b/openbsc/src/mgcp/mgcp_protocol.c @@ -98,6 +98,7 @@ static struct msgb *handle_audit_endpoint(struct mgcp_config *cfg, struct msgb * static struct msgb *handle_create_con(struct mgcp_config *cfg, struct msgb *msg); static struct msgb *handle_delete_con(struct mgcp_config *cfg, struct msgb *msg); static struct msgb *handle_modify_con(struct mgcp_config *cfg, struct msgb *msg); +static struct msgb *handle_rsip(struct mgcp_config *cfg, struct msgb *msg); static int generate_call_id(struct mgcp_config *cfg) { @@ -129,6 +130,9 @@ static const struct mgcp_request mgcp_requests [] = { MGCP_REQUEST("CRCX", handle_create_con, "CreateConnection") MGCP_REQUEST("DLCX", handle_delete_con, "DeleteConnection") MGCP_REQUEST("MDCX", handle_modify_con, "ModifiyConnection") + + /* SPEC extension */ + MGCP_REQUEST("RSIP", handle_rsip, "ReSetInProgress") }; static struct msgb *mgcp_msgb_alloc(void) @@ -655,6 +659,13 @@ error3: return create_response(error_code, "DLCX", trans_id); } +static struct msgb *handle_rsip(struct mgcp_config *cfg, struct msgb *msg) +{ + if (cfg->reset_cb) + cfg->reset_cb(cfg); + return NULL; +} + struct mgcp_config *mgcp_config_alloc(void) { struct mgcp_config *cfg;