From 19c018affd0787c00a28c8189cb173f8a84b6d87 Mon Sep 17 00:00:00 2001 From: sauwming Date: Wed, 10 Jan 2024 16:55:23 +0800 Subject: [PATCH] Fixed Service-Route update upon registration (#3823) --- pjsip/src/pjsua-lib/pjsua_acc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c index d951ccb45..a72d1a278 100644 --- a/pjsip/src/pjsua-lib/pjsua_acc.c +++ b/pjsip/src/pjsua-lib/pjsua_acc.c @@ -2002,7 +2002,7 @@ static void update_service_route(pjsua_acc *acc, pjsip_rx_data *rdata) pj_size_t rcnt; /* Find and parse Service-Route headers */ - for (;;) { + for (;(rdata);) { char saved; int parsed_len; @@ -2054,9 +2054,6 @@ static void update_service_route(pjsua_acc *acc, pjsip_rx_data *rdata) break; } - if (uri_cnt == 0) - return; - /* * Update account's route set */ @@ -2416,6 +2413,9 @@ static void regc_cb(struct pjsip_regc_cbparam *param) (int)param->reason.slen, param->reason.ptr)); destroy_regc(acc, PJ_TRUE); + /* Clear Service-Route header */ + update_service_route(acc, NULL); + /* Stop keep-alive timer if any. */ update_keep_alive(acc, PJ_FALSE, NULL); } else if (PJSIP_IS_STATUS_IN_CLASS(param->code, 200)) {