summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2016-05-09 03:29:28 +0000
committerLiong Sauw Ming <ming@teluu.com>2016-05-09 03:29:28 +0000
commitbd669b9c601fa8c18e7fbfb6789d6135f1b4224b (patch)
treed584344e087a5fb95dc3804b0bedd3602808d1da
parentd3a32eaf6bc179dc910a2c79c4802ccb6f30ebbe (diff)
Fixed #1913: Add callback for address change notification from STUN keep alive
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5282 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjnath/include/pjnath/ice_strans.h8
-rw-r--r--pjnath/src/pjnath/ice_strans.c8
-rw-r--r--pjsip/src/pjsua-lib/pjsua_media.c5
3 files changed, 18 insertions, 3 deletions
diff --git a/pjnath/include/pjnath/ice_strans.h b/pjnath/include/pjnath/ice_strans.h
index 340bf605..d711d951 100644
--- a/pjnath/include/pjnath/ice_strans.h
+++ b/pjnath/include/pjnath/ice_strans.h
@@ -125,10 +125,14 @@ typedef enum pj_ice_strans_op
/** Negotiation */
PJ_ICE_STRANS_OP_NEGOTIATION,
- /** This operatino is used to report failure in keep-alive operation.
+ /** This operation is used to report failure in keep-alive operation.
* Currently it is only used to report TURN Refresh failure.
*/
- PJ_ICE_STRANS_OP_KEEP_ALIVE
+ PJ_ICE_STRANS_OP_KEEP_ALIVE,
+
+ /** IP address change notification from STUN keep-alive operation.
+ */
+ PJ_ICE_STRANS_OP_ADDR_CHANGE
} pj_ice_strans_op;
diff --git a/pjnath/src/pjnath/ice_strans.c b/pjnath/src/pjnath/ice_strans.c
index aee0c39d..66dce88e 100644
--- a/pjnath/src/pjnath/ice_strans.c
+++ b/pjnath/src/pjnath/ice_strans.c
@@ -1640,6 +1640,14 @@ static pj_bool_t stun_on_status(pj_stun_sock *stun_sock,
sizeof(ipaddr), 3)));
sess_init_update(ice_st);
+
+ if (op == PJ_STUN_SOCK_MAPPED_ADDR_CHANGE &&
+ ice_st->cb.on_ice_complete)
+ {
+ (*ice_st->cb.on_ice_complete)(ice_st,
+ PJ_ICE_STRANS_OP_ADDR_CHANGE,
+ status);
+ }
}
}
diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c
index f659e23e..5f948973 100644
--- a/pjsip/src/pjsua-lib/pjsua_media.c
+++ b/pjsip/src/pjsua-lib/pjsua_media.c
@@ -679,6 +679,7 @@ static void on_ice_complete(pjmedia_transport *tp,
pjsua_call_schedule_reinvite_check(call, 0);
break;
case PJ_ICE_STRANS_OP_KEEP_ALIVE:
+ case PJ_ICE_STRANS_OP_ADDR_CHANGE:
if (result != PJ_SUCCESS) {
PJ_PERROR(4,(THIS_FILE, result,
"ICE keep alive failure for transport %d:%d",
@@ -695,7 +696,9 @@ static void on_ice_complete(pjmedia_transport *tp,
(*pjsua_var.ua_cfg.cb.on_call_media_transport_state)(
call->index, &info);
}
- if (pjsua_var.ua_cfg.cb.on_ice_transport_error) {
+ if (pjsua_var.ua_cfg.cb.on_ice_transport_error &&
+ op == PJ_ICE_STRANS_OP_KEEP_ALIVE)
+ {
pjsua_call_id id = call->index;
(*pjsua_var.ua_cfg.cb.on_ice_transport_error)(id, op, result,
NULL);