From 941248879dc159eb2c053e9788b80301e4be8ef0 Mon Sep 17 00:00:00 2001 From: russell Date: Mon, 12 May 2008 15:08:41 +0000 Subject: Merge rev 115565 from 1.4 git-svn-id: http://svn.digium.com/svn/asterisk/tags/1.4.19.2@115647 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_iax2.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'channels') diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 3aeae2a87..2825019ad 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -3616,6 +3616,24 @@ static int iax2_indicate(struct ast_channel *c, int condition, const void *data, ast_mutex_lock(&iaxsl[callno]); pvt = iaxs[callno]; + if (!pvt->peercallno) { + /* We don't know the remote side's call number, yet. :( */ + int count = 10; + while (count-- && pvt && !pvt->peercallno) { + ast_mutex_unlock(&iaxsl[callno]); + usleep(1); + ast_mutex_lock(&iaxsl[callno]); + pvt = iaxs[callno]; + } + if (pvt->peercallno) { + ast_log(LOG_NOTICE, "Yay, we didn't know the peercallno, but we were patient and got it.\n"); + } else { + ast_log(LOG_NOTICE, "Damnit! We waited around and never got the peercallno ...\n"); + res = -1; + goto done; + } + } + switch (condition) { case AST_CONTROL_HOLD: if (strcasecmp(pvt->mohinterpret, "passthrough")) { -- cgit v1.2.3