From f5a7735f21f0f68a7a4368bfc941814528c718a3 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 6 Apr 2022 14:56:42 -0400 Subject: [PATCH] TT#170203 add support for REFER Also take this opportunity to renumber the method codes for easier maintenance. Change-Id: I8e7998deb2e2998eb308121ad94e6d68c9eae5b0 --- cdr.c | 4 ++++ cdr.h | 1 + mediator.h | 7 ++++--- medredis.c | 5 +++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cdr.c b/cdr.c index de018ca..4232c0f 100644 --- a/cdr.c +++ b/cdr.c @@ -1629,6 +1629,10 @@ void cdr_parse_entry(med_entry_t *e) { e->method = MED_BYE; } + else if (strcmp(e->sip_method, MSG_REFER) == 0) + { + e->method = MED_REFER; + } else { e->method = MED_UNRECOGNIZED; diff --git a/cdr.h b/cdr.h index 85d5c03..595580e 100644 --- a/cdr.h +++ b/cdr.h @@ -5,6 +5,7 @@ #define MSG_INVITE "INVITE" #define MSG_BYE "BYE" +#define MSG_REFER "REFER" #define CDR_STATUS_OK "ok" #define CDR_STATUS_BUSY "busy" diff --git a/mediator.h b/mediator.h index c2137da..fa94215 100644 --- a/mediator.h +++ b/mediator.h @@ -69,9 +69,10 @@ extern int mediator_lockfd; extern sig_atomic_t mediator_shutdown; typedef enum { - MED_INVITE = 1, - MED_BYE = 2, - MED_UNRECOGNIZED = 3 + MED_UNRECOGNIZED = 0, + MED_INVITE, + MED_BYE, + MED_REFER, } med_method_t; diff --git a/medredis.c b/medredis.c index 56927eb..b370e27 100644 --- a/medredis.c +++ b/medredis.c @@ -273,12 +273,13 @@ static int medredis_remove_mappings(const char* cid, char* key, const char *meth } // delete cid from acc:meth::$METHOD and handle acc::index::meth mappings - char *methods[2]; + char *methods[3]; int num_methods; if (!method || !method[0]) { methods[0] = "acc:meth::INVITE"; methods[1] = "acc:meth::BYE"; - num_methods = 2; + methods[2] = "acc:meth::REFER"; + num_methods = 3; } else { method_key = g_strdup_printf("acc:meth::%s", method);