Skip to content

Commit 180bb3a

Browse files
committed
cami: Handle async OriginateResponse.
When issuing an async Originate action, we immediately get an eventless Success response (with the corresponding ActionID), but then later get back an OriginateResponse with the same ActionID. This confused the current parsing, as the "ActionID" bit would lead us to set middle_of_response = 1 and then get stuck, thinking we were in the middle of a response, leading to further events getting lost. To mitigate this, if we get an event with an Action ID but a response was not already pending, don't set middle_of_response = 1.
1 parent 2570719 commit 180bb3a

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

cami.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,11 @@ static void *ami_loop(void *varg)
358358
end_of_response = 1;
359359
}
360360
/* Whether this event is the Response bit or a plain Event, some line (NOT necessarily the 2nd)
361-
* will have an ActionID, if it belongs to a response. */
362-
if (strstr(nextevent, "ActionID:")) {
361+
* will have an ActionID, if it belongs to a response.
362+
*
363+
* An edge case here is async Originate actions, which result in an async OriginateResponse later
364+
* with the same action ID. We don't want to get confused and think a response is pending at this point. */
365+
if (strstr(nextevent, "ActionID:") && response_pending) {
363366
middle_of_response = 1;
364367
}
365368
}

0 commit comments

Comments
 (0)