Ios – IONIC/cordova, make phone call in IOS

cordovaios

I have found a thread in ionic on this topic: http://forum.ionicframework.com/t/making-phone-call-from-app-href-tel-123/1968/11.

It mentions the whitelist plugin:
https://github.com/apache/cordova-plugin-whitelist

So I try to add these code in the config.xml, but it still can not work.

<access origin="tel:*" launch-external="yes" />
<access origin="mailto:*" launch-external="yes" >

<allow-intent href="tel:*" />

HTML:

<a href="tel: 110">call</a>

Error:

2015-07-03 00:21:16.231 myParking[27167:1006045] Failed to load
webpage with error: The URL can’t be shown

I try to use another plugin, but it still can not work.

https://github.com/Rohfosho/CordovaCallNumberPlugin

HTML:

<span ng-click="onDail($index)">call</span>

JS:

var onSuccess = function(){
    console.log("success");
}

var onError = function(){
    console.log("fail");
}

$scope.onDail = function(index){
    window.plugins.CallNumber.callNumber(onSuccess, onError, $scope.ParkingRecords[index].number);
}

Error:

2015-07-03 00:24:09.620 myParking[27308:1007392] fail

So how can I make this work?

ionic version: 1.4.3
cordova version: 5.0.0

Best Answer

I try it in a tag it worked on android:

First add cordova-plugin-whitelist

cordova add plugin cordova-plugin-whitelist

Then add following lines in config.xml

<access origin="tel:*" launch-external="yes" />
<allow-intent href="tel:*" />

Finally in a tag use line below

<a href="tel:555 555 5555" target="_blank">
    <i class="fa fa-phone"></i>
</a>