cmeng-git / atalk-android

xmpp/jabber client for android
Apache License 2.0
159 stars 59 forks source link

making phone calls via xmpp/jingle (feature request?) #10

Closed streaps closed 6 years ago

streaps commented 6 years ago

Would it be possible to make / route phone calls to an xmpp domain. I.e calling the phone number +1-123-4567890 would establish a jingle audio session to 11234567890@host.example.com.

It would work more like a sip phone app than a traditional xmpp app.

cmeng-git commented 6 years ago

Can you elaborate a bit how is the system architecture setup? I am not sure I fully understand your request.

Are your proposing a phone call that originated from a mobile device automatically get routed to a xmpp client on a specific domain; and who is providing this service to map a phone number to an xmpp client? This look like the telephone and ISP service providers need to work together and to have this phone-to-xmpp client translation feature supported on their network. I do not see any economical incentive for them to support this.

Or are you looking an xmpp client making a 11234567890@host.example.com, then the xmpp domain server extract the phone number and make a normal phone call (via landline or mobile) via a gateway installed on xmpp server. Are you aware of any xmpp server that intrinsically or via plugin that can support this feature.

I see there was a similar request to Conversation: https://github.com/siacs/Conversations/issues/906

streaps commented 6 years ago

Or are you looking an xmpp client making a 11234567890@host.example.com, then the xmpp domain server extract the phone number and make a normal phone call (via landline or mobile) via a gateway installed on xmpp server.

Exactly. You're description is better than mine. I think it is mostly about the user interface. Like some dial pad, where the user can type in the phone number or Dial a phone number from the Android contacts. It would look and behave like a standard SIP client.

Linphone UI   Zoiper

Or just a simple field where you can put in the phone number (maybe it's already possible and I haven't figured out how to do it).

Jitsi Desktop

streaps commented 6 years ago

Are you aware of any xmpp server that intrinsically or via plugin that can support this feature.

What is needed is some sort of XMPP-SIP Gateway. Some solutions come to mind:

There is a Jingle/SIP proxy module für MongooseIM, which was recently released:
https://www.erlang-solutions.com/blog/mongooseim-2-2-the-global-server.html

SylkServer implements also a SIP/XMPP Gateway http://sylkserver.com/ http://sylkserver.ag-projects.com/projects/sylkserver/wiki/DesignXMPP http://sylkserver.ag-projects.com/projects/sylkserver/wiki/DesignXMPP_arch

Asterisk has chan_motif (Jingle) and res_xmpp (client and component)

Freeswitch supports xmpp and jingle with mod_dingaling

Yate has a Jabber Server and Jinglie Module http://docs.yate.ro/wiki/Yjinglechan

I haven't tested any of that recently.

streaps commented 6 years ago

To be clear, this is not a feature that would automatically work for every atalk user. I'm not sure if anyone beside me is interested in an XMPP client that could replace a SIP client / phone.

cmeng-git commented 6 years ago

Thanks for the clarification. Actually I was about to implement, but then I realize my home server which is based on ejabberd 18.03, does not support this feature, OR I am not aware ejabberd has a plugin to support this.

Any advice how do I perform the system testing on the feature?

streaps commented 6 years ago

I don't have any advice at the moment. I'm playing around with Asterisk, but haven't had any success yet. I'll keep you posted.

streaps commented 6 years ago

I configured Asterisk to register as a client to my xmpp server. Initiating a call from Asterisk to aTalk does work, but I'm unable to make a call from aTalk, because the phone icon never appears.

Asterisk can also connect as an external component to the xmpp server, but I don't know if and how it could be used for jingle calls. There is not much documentation.

<iq from='asterisk.example.com' to='jabberuser@example.com/atalk' id='VwA0c-48' type='result'><query xmlns='http://jabber.org/protocol/disco#info'><identity category='gateway' type='pstn' name='Asterisk The Open Source PBX'/><feature var='http://jabber.org/protocol/disco'/><feature var='jabber:iq:register'/><feature var='http://jabber.org/protocol/commands'/><feature var='jabber:iq:gateway'/><feature var='jabber:iq:version'/><feature var='vcard-temp'/><search var='jabber:iq:search'/></query></iq>

cmeng-git commented 6 years ago

I have implemented the external phone feature and its basic function. Still trying to understand how this work. As for now, the system will throw error that the called phone contact is not in the contact list as expected.

extphone

cmeng-git commented 6 years ago

I configured Asterisk to register as a client to my xmpp server. Initiating a call from Asterisk to aTalk does work, but I'm unable to make a call from aTalk, because the phone icon never appears.

In order for aTalk to offer audio and video call as user selectable options, the client must advertise the following two features in the Entity Capabilities. However these are xmpp features. Not sure if the Asterisk allow you to configure the client for the supported features.

I see that your client offer the following feature. \. The external phone implementation may need to make use of this info to make a successful pbx call. Need more reading.

    /**
     * Jingle's Discovery Info URN for RTP support with audio.
     */
    public static final String URN_XMPP_JINGLE_RTP_AUDIO = "urn:xmpp:jingle:apps:rtp:audio";

    /**
     * Jingle's Discovery Info URN for RTP support with video.
     */
    public static final String URN_XMPP_JINGLE_RTP_VIDEO = "urn:xmpp:jingle:apps:rtp:video";

        // XEP-0167: Jingle RTP Sessions
        supportedFeatures.add(URN_XMPP_JINGLE_RTP_AUDIO);
        // XEP-0180: Jingle Video via RTP
        supportedFeatures.add(URN_XMPP_JINGLE_RTP_VIDEO);
streaps commented 6 years ago

I'm not familiar with the Asterisk source code, but this looks to me like an Asterisks xmpp client would respond to a service discovery request and advertises jingle:

https://github.com/asterisk/asterisk/blob/certified/13.18-cert3/res/res_xmpp.c#L2424

streaps commented 6 years ago

I'm not sure if the components response to a service discovery is covered by any standard:

https://github.com/asterisk/asterisk/blob/certified/13.18-cert3/res/res_xmpp.c#L2925

cmeng-git commented 6 years ago

aTalk has completed the implementation on XMPP VoIP-Phone/Pbx gateway call establishment.

asterisk implementation follows XEP-0100 Gateway Interaction version 1.0. As such asterisk disco#info reply does not confirm to the latest XEP-0115: Entity Capabilities standard. i.e. missing attribute 'hash" and the cap version is static i.e. not calculated per method in XEP-0115. Smack library does not accept asterisk disco#info due to the two shortcomings. In order for aTalk to communicate via asterisk gateway, asterisk needs to make changes to the above two deviations. I believe the two corrections are backward compatible and should not break any existing gateway setup.

Temporary forcing smack to ignore the two deviations. atalk has successfully demonstrated it is able to make a call to asterisk gateway. However these patches will not be included in the next aTalk release due to non-standard XEP protocol.

cmeng-git commented 6 years ago

I have placed a copy of the aTalk debug version 1.3.3 on my home server. This version has patches to force smack to accept asterisk non-compliant XEP-0115 in their XEP-0100 implementation. Please note, this version is only for testing purpose. All the patches which are included in this version will be removed in the aTalk v1.4.0 release version.

The debug version can be downloaded using the link below: http://atalk.sytes.net/releases/atalk-android/aTalk-debug_1.3.3.apk

streaps commented 6 years ago

Android refuses to install it: "The package appears to be corrupt."

I have tried it on Android 4.3 and 7.1

cmeng-git commented 6 years ago

The release is a debug version. You need to enable "Unknown Sources" in android settings OR during installation. You can goggle on line on how to enable "Unknown source" for your android device version.

Also you cannot install this version over your current aTalk from playstore, as it has difference signature. You need to uninstall your existing aTalk before install this debug version.

For help on the new Telephony feature, refer to aTalk online help Jabber VoIP-PBX gateway Telephony (experimental) http://atalk.sytes.net/faq.html#media_02

streaps commented 6 years ago

I know, Unknown Sources is enabled. Usually the warning for a different signature is "The package conflicts with an existing package by the same name."

I deinstalled aTalk on both phones, before installing the apk.

cmeng-git commented 6 years ago

I downloaded the apk and installed on my note3 without any problem. What exactly is the problem or error message being shown during your installation.

streaps commented 6 years ago

Only the message

App not installed:
The package appears to be corrupt.
streaps commented 6 years ago
$ adb install aTalk-debug_1.3.3.apk 
Failed to install aTalk-debug_1.3.3.apk: Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]

$ md5sum aTalk-debug_1.3.3.apk
60d2b06617cd1319b9d96d7662feb9f8  aTalk-debug_1.3.3.apk
cmeng-git commented 6 years ago

I have official released aTalk v1.4.0 with the temporary patches to support asterisk pbx gateway service. I will only keep these patches until aTalk v1.5.x releases. Hopefully asterisk will have fix the problem by then.

streaps commented 6 years ago

If a user's (contact's) domain is the same as the Telephony domain, the call fails with:

No known Jingle transport supported by Jabber call peer Username <user@example.org>;status=Connecting

The Telephony domain was set to example.org

This also happens if I'm trying to call the user via the Telephony dialog.

cmeng-git commented 6 years ago

I cannot derived much info from your comment on the telephony domain, and the difference from the actual domain name where the telephony domain is registered on. Following is my general comments.

Actually the telephony domain is only a gateway domainJid. It is just like another contact on your main jabber server, but supports some extract gateway functions like relaying email or telephone via its gateway features.

Unless your telephony domain is also support full jabber server function, you cannot have contacts registered to a domainJid.

Also telephony domainJid is treated and handle completely differently from a normal contact by your server and aTalk. The Telephony Domain name must have associated backend gateway support setup at your server to handle its intended function.

kitkatloyalist commented 5 years ago

this ticket thread seems to be reinventing ENUM.

ENUM:

http://asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/InternetCallRouting_id288915.html

cmeng-git commented 5 years ago

aTalk Telephony implementation takes care only the establishment between an xmpp client and its registered xmpp server. The call connection and phone number mapping from the serer to the end points is the gateway implementation that resides on the server.

Also the end points need not to be public telephony system, it can just be within an office.