[mgcp] Add a change callback and send a dummy packet on MDCX.
Send a dummy packet to make sure our Gateway will discover us
and can send the ringtone to us.
diff --git a/openbsc/src/mgcp/mgcp_main.c b/openbsc/src/mgcp/mgcp_main.c
index 80b7b54..f7f1f80 100644
--- a/openbsc/src/mgcp/mgcp_main.c
+++ b/openbsc/src/mgcp/mgcp_main.c
@@ -128,6 +128,15 @@
return 0;
}
+static int mgcp_change_cb(struct mgcp_config *cfg, int endpoint, int state, int local_rtp)
+{
+ if (state != MGCP_ENDP_MDCX)
+ return 0;
+
+ mgcp_send_dummy(&cfg->endpoints[endpoint]);
+ return 0;
+}
+
static int read_call_agent(struct bsc_fd *fd, unsigned int what)
{
struct sockaddr_in addr;
@@ -200,6 +209,7 @@
/* set some callbacks */
cfg->reset_cb = mgcp_rsip_cb;
+ cfg->change_cb = mgcp_change_cb;
/* we need to bind a socket */
if (rc == 0) {