Fix #44 Add display name in the provisioning XML

This commit is contained in:
Timothée Jaussoin 2022-09-29 16:31:37 +02:00
parent 54b9c2a3f3
commit 006ddaca5f
5 changed files with 14 additions and 3 deletions

View file

@ -173,6 +173,15 @@ class Account extends Authenticatable
return $this->attributes['username'] . '@' . $this->attributes['domain']; return $this->attributes['username'] . '@' . $this->attributes['domain'];
} }
public function getFullIdentifierAttribute()
{
$displayName = $this->attributes['display_name']
? '"' . $this->attributes['display_name'] . '" '
: '';
return $displayName . '<sip:' . $this->getIdentifierAttribute() . '>';
}
public function getRealmAttribute() public function getRealmAttribute()
{ {
return config('app.realm'); return config('app.realm');

View file

@ -148,7 +148,7 @@ class ProvisioningController extends Controller
$section = $dom->createElement('section'); $section = $dom->createElement('section');
$section->setAttribute('name', 'proxy_' . $proxyConfigIndex); $section->setAttribute('name', 'proxy_' . $proxyConfigIndex);
$entry = $dom->createElement('entry', '<sip:' . $account->identifier . '>'); $entry = $dom->createElement('entry', $account->fullIdentifier);
$entry->setAttribute('name', 'reg_identity'); $entry->setAttribute('name', 'reg_identity');
$section->appendChild($entry); $section->appendChild($entry);
@ -228,7 +228,7 @@ class ProvisioningController extends Controller
$section = $dom->createElement('section'); $section = $dom->createElement('section');
$section->setAttribute('name', 'proxy_' . $proxyConfigIndex); $section->setAttribute('name', 'proxy_' . $proxyConfigIndex);
$entry = $dom->createElement('entry', '<sip:' . $externalAccount->identifier . '>'); $entry = $dom->createElement('entry', $externalAccount->fullIdentifier);
$entry->setAttribute('name', 'reg_identity'); $entry->setAttribute('name', 'reg_identity');
$section->appendChild($entry); $section->appendChild($entry);

View file

@ -32,6 +32,7 @@ class AccountFactory extends Factory
{ {
return [ return [
'username' => $this->faker->username, 'username' => $this->faker->username,
'display_name' => $this->faker->username,
'domain' => config('app.sip_domain'), 'domain' => config('app.sip_domain'),
'email' => $this->faker->email, 'email' => $this->faker->email,
'user_agent' => $this->faker->userAgent, 'user_agent' => $this->faker->userAgent,

View file

@ -92,6 +92,7 @@ class AccountProvisioningTest extends TestCase
->assertStatus(200) ->assertStatus(200)
->assertHeader('Content-Type', 'application/xml') ->assertHeader('Content-Type', 'application/xml')
->assertSee($password->account->username) ->assertSee($password->account->username)
->assertSee($password->account->display_name)
->assertSee('ha1'); ->assertSee('ha1');
} }

View file

@ -8,7 +8,7 @@
#%define _datadir %{_datarootdir} #%define _datadir %{_datarootdir}
#%define _docdir %{_datadir}/doc #%define _docdir %{_datadir}/doc
%define build_number 153 %define build_number 154
%define var_dir /var/opt/belledonne-communications %define var_dir /var/opt/belledonne-communications
%define opt_dir /opt/belledonne-communications/share/flexisip-account-manager %define opt_dir /opt/belledonne-communications/share/flexisip-account-manager