From 913b4d64bc20cac6796d7ba523a11ec4326ef701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Jaussoin?= Date: Wed, 3 Nov 2021 16:54:18 +0100 Subject: [PATCH] Add the Vcard4 provisioning URL in the provisioning XML Fix the Vcard4 format to comply with liblinphone --- flexiapi/app/Account.php | 4 ++-- .../Account/ProvisioningController.php | 9 ++++++++ flexiapi/composer.lock | 21 ++++++++++--------- flexiapi/routes/web.php | 4 ++-- .../tests/Feature/AccountProvisioningTest.php | 3 ++- flexisip-account-manager.spec | 2 +- 6 files changed, 27 insertions(+), 16 deletions(-) diff --git a/flexiapi/app/Account.php b/flexiapi/app/Account.php index 884a30d..d0a6c5e 100644 --- a/flexiapi/app/Account.php +++ b/flexiapi/app/Account.php @@ -231,11 +231,11 @@ class Account extends Authenticatable $vcard = 'BEGIN:VCARD VERSION:4.0 KIND:individual -MEMBER:'.$this->getIdentifierAttribute(); +IMPP:sip:'.$this->getIdentifierAttribute(); if (!empty($this->attributes['display_name'])) { $vcard . ' -NAME:'.$this->attributes['display_name']; +FN:'.$this->attributes['display_name']; } if ($this->types) { diff --git a/flexiapi/app/Http/Controllers/Account/ProvisioningController.php b/flexiapi/app/Http/Controllers/Account/ProvisioningController.php index 057b2d9..3b9a2b3 100644 --- a/flexiapi/app/Http/Controllers/Account/ProvisioningController.php +++ b/flexiapi/app/Http/Controllers/Account/ProvisioningController.php @@ -115,6 +115,15 @@ class ProvisioningController extends Controller ->first(); } + $section = $dom->createElement('section'); + $section->setAttribute('name', 'misc'); + + $entry = $dom->createElement('entry', route('account.contacts.vcard.index')); + $entry->setAttribute('name', 'contacts-vcard-list'); + $section->appendChild($entry); + + $config->appendChild($section); + if ($account && !$account->activationExpired()) { $section = $dom->createElement('section'); $section->setAttribute('name', 'proxy_' . $proxyConfigIndex); diff --git a/flexiapi/composer.lock b/flexiapi/composer.lock index e988d13..73d5cee 100644 --- a/flexiapi/composer.lock +++ b/flexiapi/composer.lock @@ -1038,16 +1038,16 @@ }, { "name": "laravel/framework", - "version": "v8.68.1", + "version": "v8.69.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "abe985ff1fb82dd04aab03bc1dc56e83fe61a59f" + "reference": "545181da688db64fed6d8427e55f630a90ca0d32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/abe985ff1fb82dd04aab03bc1dc56e83fe61a59f", - "reference": "abe985ff1fb82dd04aab03bc1dc56e83fe61a59f", + "url": "https://api.github.com/repos/laravel/framework/zipball/545181da688db64fed6d8427e55f630a90ca0d32", + "reference": "545181da688db64fed6d8427e55f630a90ca0d32", "shasum": "" }, "require": { @@ -1206,7 +1206,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2021-10-27T12:31:46+00:00" + "time": "2021-11-02T13:53:22+00:00" }, { "name": "laravel/serializable-closure", @@ -1759,16 +1759,16 @@ }, { "name": "nesbot/carbon", - "version": "2.53.1", + "version": "2.54.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "f4655858a784988f880c1b8c7feabbf02dfdf045" + "reference": "eed83939f1aed3eee517d03a33f5ec587ac529b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/f4655858a784988f880c1b8c7feabbf02dfdf045", - "reference": "f4655858a784988f880c1b8c7feabbf02dfdf045", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/eed83939f1aed3eee517d03a33f5ec587ac529b5", + "reference": "eed83939f1aed3eee517d03a33f5ec587ac529b5", "shasum": "" }, "require": { @@ -1779,6 +1779,7 @@ "symfony/translation": "^3.4 || ^4.0 || ^5.0" }, "require-dev": { + "doctrine/dbal": "^2.0 || ^3.0", "doctrine/orm": "^2.7", "friendsofphp/php-cs-fixer": "^3.0", "kylekatarnls/multi-tester": "^2.0", @@ -1849,7 +1850,7 @@ "type": "tidelift" } ], - "time": "2021-09-06T09:29:23+00:00" + "time": "2021-11-01T21:22:20+00:00" }, { "name": "nikic/php-parser", diff --git a/flexiapi/routes/web.php b/flexiapi/routes/web.php index d82a546..aabc740 100644 --- a/flexiapi/routes/web.php +++ b/flexiapi/routes/web.php @@ -36,8 +36,8 @@ Route::group(['middleware' => 'auth.digest_or_key'], function () { Route::get('provisioning/me', 'Account\ProvisioningController@me')->name('provisioning.me'); // Vcard 4.0 - Route::get('contacts/vcard/{sip}', 'Account\ContactVcardController@show'); - Route::get('contacts/vcard', 'Account\ContactVcardController@index'); + Route::get('contacts/vcard/{sip}', 'Account\ContactVcardController@show')->name('account.contacts.vcard.show'); + Route::get('contacts/vcard', 'Account\ContactVcardController@index')->name('account.contacts.vcard.index'); }); Route::get('provisioning/qrcode/{confirmation}', 'Account\ProvisioningController@qrcode')->name('provisioning.qrcode'); diff --git a/flexiapi/tests/Feature/AccountProvisioningTest.php b/flexiapi/tests/Feature/AccountProvisioningTest.php index ca9eb23..4836e6d 100644 --- a/flexiapi/tests/Feature/AccountProvisioningTest.php +++ b/flexiapi/tests/Feature/AccountProvisioningTest.php @@ -57,7 +57,8 @@ class AccountProvisioningTest extends TestCase ->get($this->accountRoute) ->assertStatus(200) ->assertHeader('Content-Type', 'application/xml') - ->assertSee('ha1'); + ->assertSee('ha1') + ->assertSee('contacts-vcard-list'); // And then twice $response = $this->keyAuthenticated($password->account) diff --git a/flexisip-account-manager.spec b/flexisip-account-manager.spec index 8bb279d..9699e17 100644 --- a/flexisip-account-manager.spec +++ b/flexisip-account-manager.spec @@ -8,7 +8,7 @@ #%define _datadir %{_datarootdir} #%define _docdir %{_datadir}/doc -%define build_number 110 +%define build_number 111 %define var_dir /var/opt/belledonne-communications %define opt_dir /opt/belledonne-communications/share/flexisip-account-manager