https://sourceforge.net/p/iaxmodem/code/46/
https://sourceforge.net/p/iaxmodem/discussion/497500/thread/b2469a0d1a/

Index: iaxmodem.c
===================================================================
--- ./iaxmodem.c	(revision 45)
+++ ./iaxmodem.c	(working copy)
@@ -543,7 +543,7 @@
 	    printlog(LOG_INFO, "Answering\n");
 
 	    /* Unset V.24 Circuit 125, "ring indicator". */
-	    int tioflags;
+	    int tioflags = 0;
 	    ioctl(aslave, TIOCMGET, &tioflags);
 	    tioflags &= ~TIOCM_RI;
 	    ioctl(aslave, TIOCMSET, &tioflags);
@@ -762,7 +762,7 @@
     int16_t iaxbuf[VOIP_PACKET_SIZE];
     static t31_state_t t31_state;
     int t31buflen;
-    int tioflags;
+    int tioflags = 0;
     struct group *grent;
     char *devgroup;
     char *pmode;
Index: lib/libiax2/src/iax.c
===================================================================
--- ./lib/libiax2/src/iax.c	(revision 45)
+++ ./lib/libiax2/src/iax.c	(working copy)
@@ -3283,20 +3283,7 @@
 				/* It's been acked.  No need to send it.   Destroy the old
 				   frame. If final, destroy the session. */
 				if (frame->final)
-					/* sskacar: Quick deallocation and allocation of sessions may result in
-					   the same-address-use ! Therefore we cannot trust remote-sent address only
-					   Best bet is checking by somewhat unique properties to decide
-					   if we really intend to destroy this session.
-					   Example Case:
-					   - Have a call
-					   - Dump that call and immediately request a new call (or have a incoming call request by a lesser chance)
-					   - By considerable probability, you might get the previous address for the session.
-					   - When execution hits to this point as a result of previous call ending
-					     (as client informs server about dumping and frees the previous session,
-					      server proccess call-dumping and eventually this point reached)
-					   - frame->session param to the destroy_session() belongs to the new & valid session ! */
-					if (frame->session && (frame->callno == frame->session->callno))
-						destroy_session(frame->session);
+					destroy_session(frame->session);
 				if (frame->data)
 					free(frame->data);
 				free(frame);
Index: lib/spandsp/src/at_interpreter.c
===================================================================
--- ./lib/spandsp/src/at_interpreter.c	(revision 45)
+++ ./lib/spandsp/src/at_interpreter.c	(working copy)
@@ -44,6 +44,7 @@
 #include <string.h>
 #include <ctype.h>
 #include <assert.h>
+#include <syslog.h>
 
 #include "spandsp/telephony.h"
 #include "spandsp/logging.h"
@@ -672,43 +673,6 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static int parse_string_out(at_state_t *s, const char **t, char **target, const char *prefix)
-{
-    char buf[100];
-
-    switch (*(*t)++)
-    {
-    case '=':
-        switch (**t)
-        {
-        case '?':
-            /* Show possible values */
-            (*t)++;
-            snprintf(buf, sizeof(buf), "%s", (prefix)  ?  prefix  :  "");
-            at_put_response(s, buf);
-            break;
-        default:
-            /* Set value */
-            if (*target)
-                free(*target);
-            /* If this strdup fails, it should be harmless */
-            *target = strdup(*t);
-            break;
-        }
-        break;
-    case '?':
-        /* Show current index value */
-        at_put_response(s, (*target)  ?  *target  :  "");
-        break;
-    default:
-        return FALSE;
-    }
-    while (*t)
-        t++;
-    return TRUE;
-}
-/*- End of function --------------------------------------------------------*/
-
 static const char *s_reg_handler(at_state_t *s, const char *t, int reg)
 {
     int val;
@@ -4965,10 +4929,31 @@
 {
     /* Extension of V.253 +VCID, Set calling number ID */
     t += 5;
-    if (!parse_string_out(s, &t, &s->local_id, NULL))
+    switch (*t)
+    {
+    case '=':
+        switch (*(t+1))
+        {
+        case '?':
+            /* Show possible values */
+            at_put_response(s, "");
+            break;
+        default:
+            /* Set value */
+            s->local_id = strdup(t + 1);
+            if (at_modem_control(s, AT_MODEM_CONTROL_SETID, s->local_id) < 0)
+                return NULL;
+            break;
+        }
+        break;
+    case '?':
+        /* Show current index value from def */
+        at_put_response(s, (s->local_id)  ?  s->local_id  :  "");
+        break;
+    default:
         return NULL;
-    if (at_modem_control(s, AT_MODEM_CONTROL_SETID, s->local_id) < 0)
-        return NULL;
+    }
+    while (*t) t++;
     return t;
 }
 /*- End of function --------------------------------------------------------*/
