Skip to content

Fixed Dependencies, add Yealink_3 for T46G #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ Edit `config.example.php` and save as `config.php` or use an other name of your
### List all commands

```console
./fbconvertconv list
./fbcontactconv list
```

### Complete processing

```console
./fbconvertconv run
./fbcontactconv run
```

### Get help for a command

```console
./fbconvertconv run -h
./fbcontactconv run -h
```

### Export phonebooks
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
}
],
"require": {
"php": "^7.0",
"symfony/console": "^3.0",
"blacksenator/fritzsoap": "^2.1",
"blacksenator/fritzdbf": "^1.4"
"php": ">=7.0",
"symfony/console": ">=3.0",
"blacksenator/fritzsoap": ">=2.1",
"blacksenator/fritzdbf": ">=1.4"
},
"autoload": {
"psr-4": {
Expand All @@ -23,6 +23,6 @@
"files": ["src/functions.php"]
},
"require-dev": {
"phpunit/phpunit": "^6"
"phpunit/phpunit": ">=6"
}
}
10 changes: 10 additions & 0 deletions config.example.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@
'path' => '',
'file' => 'LocalPhonebook.xml',
],
'Yealink2' => [
'xsl' => 'Yealink_2.xsl',
'path' => '',
'file' => 'LocalPhonebook2.xml',
],
'Yealink3' => [
'xsl' => 'Yealink_3.xsl',
'path' => '',
'file' => 'LocalPhonebook3.xml',
]
'snom' => [
'xsl' => 'snom.xsl',
'path' => '',
Expand Down
51 changes: 51 additions & 0 deletions lib/Yealink_3.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Transform FRITZ!Box telephone book into Yealink IP phonebook -->
<!-- Copyright Volker Püschel -->
<!-- MIT Licence -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" encoding="utf-8" />



<xsl:template match="phonebooks/phonebook">
<root_contact>
<xsl:apply-templates select="contact" />
</root_contact>
</xsl:template>

<xsl:template match="contact">
<contact>
<xsl:apply-templates select="person/realName | telephony/number" />
<xsl:attribute name="line">0</xsl:attribute>
<xsl:attribute name="ring">Auto</xsl:attribute>
<xsl:attribute name="default_photo">Resource:icon_family_b.png</xsl:attribute>
<xsl:attribute name="selected_photo">0</xsl:attribute>
<xsl:attribute name="group_id_name">All Contacts</xsl:attribute>
</contact>
</xsl:template>

<xsl:template match="person/realName">
<xsl:attribute name="display_name">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:template>

<xsl:template match="telephony/number">
<!-- exclude fax numbers-->
<xsl:if test="@type!='fax_work'">
<xsl:choose>
<xsl:when test="@type='work'">
<xsl:attribute name="office_number"><xsl:value-of select="." /></xsl:attribute>
</xsl:when>
<xsl:when test="@type='mobile'">
<xsl:attribute name="mobile_number"><xsl:value-of select="." /></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="other_number"><xsl:value-of select="." /></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>

</xsl:stylesheet>
3 changes: 2 additions & 1 deletion src/RunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ protected function configure()
$this->addConfig();
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->loadConfig($input);
error_log('Converting FRITZ!Box contacts...');
convertFBphonebook($this->config);
return 0;
}
}