Fixed bug in audio media parameter passing in SIP calls.

Worked around problem with 3rd array_walk parameter passed by reference in PHP.


git-svn-id: http://yate.null.ro/svn/yate/trunk@543 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2005-10-19 19:45:14 +00:00
parent a704232d1f
commit b9703fb8da
2 changed files with 10 additions and 4 deletions

View File

@ -1203,6 +1203,7 @@ YateSIPConnection::YateSIPConnection(SIPEvent* ev, SIPTransaction* tr)
ObjList* l = m_rtpMedia->skipNull();
for (; l; l = l->skipNext()) {
RtpMedia* r = static_cast<RtpMedia*>(l->get());
m->addParam("media"+r->suffix(),"yes");
m->addParam("rtp_port"+r->suffix(),r->remotePort());
m->addParam("formats"+r->suffix(),r->formats());
}
@ -1627,7 +1628,7 @@ SDPBody* YateSIPConnection::createRtpSDP(const char* addr, const Message& msg)
if (defaults && !lst) {
lst = new ObjList;
lst->append(new RtpMedia("audio","alaw,mulaw"));
lst->append(new RtpMedia("audio",msg.getValue("formats","alaw,mulaw")));
}
setMedia(lst);

View File

@ -205,7 +205,8 @@ class Yate
$n=Yate::Escape($this->name);
$r=Yate::Escape($this->retval);
$p="";
array_walk($this->params, "_yate_message_walk", &$p);
$pa = array(&$p);
array_walk($this->params, "_yate_message_walk", $pa);
print "%%>message:$i:$t:$n:$r$p\n";
$this->type="dispatched";
}
@ -225,7 +226,8 @@ class Yate
$n=Yate::Escape($this->name);
$r=Yate::Escape($this->retval);
$p="";
array_walk($this->params, "_yate_message_walk", &$p);
$pa = array(&$p);
array_walk($this->params, "_yate_message_walk", $pa);
print "%%<message:$i:$k:$n:$r$p\n";
$this->type="acknowledged";
}
@ -330,7 +332,10 @@ function _yate_error_handler($errno, $errstr, $errfile, $errline)
/* Internal function */
function _yate_message_walk($item, $key, &$result)
{
$result .= ':' . Yate::Escape($key,'=') . '=' . Yate::Escape($item);
// workaround to pass by reference the 3rd parameter to message_walk:
// the reference is placed in an array and the array is passed by value
// taken from: http://hellsgate.online.ee/~glen/array_walk2.php
$result[0] .= ':' . Yate::Escape($key,'=') . '=' . Yate::Escape($item);
}
/* vi: set ts=8 sw=4 sts=4 noet: */