mirror of
https://gitlab.linphone.org/BC/public/flexisip-account-manager.git
synced 2026-04-17 19:58:27 +00:00
Fix FLEXIAPI-175 and FLEXISIP-231 Rewrite the Redis contacts parser to handle...
This commit is contained in:
parent
ec286ff9a8
commit
09ec7ee043
2 changed files with 12 additions and 17 deletions
|
|
@ -3,6 +3,10 @@
|
|||
v1.5
|
||||
----
|
||||
|
||||
v1.4.7
|
||||
------
|
||||
- Fix FLEXIAPI-175 and FLEXISIP-231 Rewrite the Redis contacts parser to handle properly SIP uris (thanks @thibault.lemaire !)
|
||||
|
||||
v1.4.6
|
||||
------
|
||||
- Fix FLEXIAPI-142 PUT /accounts endpoint doesn't allow overiding values anymore
|
||||
|
|
|
|||
|
|
@ -26,25 +26,16 @@ class Device extends Model
|
|||
{
|
||||
public function fromRedisContact(string $contact)
|
||||
{
|
||||
// Ugly :'(
|
||||
$result = [];
|
||||
$exploded = explode(';', urldecode($contact));
|
||||
preg_match("/<(.*)>;(.*)/", $contact, $matches);
|
||||
|
||||
foreach ($exploded as $line) {
|
||||
$line = explode('=', $line);
|
||||
$parsed = parse_url($matches[1]);
|
||||
parse_str($parsed["query"], $query);
|
||||
|
||||
if (count($line) == 2) {
|
||||
$result[trim($line[0])] = $line[1];
|
||||
}
|
||||
parse_str(str_replace(";", "&", $parsed["path"]), $sipParams);
|
||||
parse_str(str_replace(";", "&", $matches[2]), $sipHeaders);
|
||||
|
||||
// User agent
|
||||
if (count($line) == 4) {
|
||||
$result['userAgent'] = substr($line[3], 0, -1);
|
||||
}
|
||||
}
|
||||
|
||||
$this->uuid = \substr($result['sip.instance'], 2, -2);
|
||||
$this->update_time = Carbon::createFromTimestamp($result['updatedAt']);
|
||||
$this->user_agent = $result['userAgent'];
|
||||
$this->uuid = substr($sipHeaders['sip_instance'], 2, -2);
|
||||
$this->update_time = Carbon::createFromTimestamp($sipParams['updatedAt']);
|
||||
$this->user_agent = $query["user-agent"];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue