View Single Post
  #3 (permalink)  
Old 01-28-2009, 04:24 AM
pberger pberger is offline
Junior Member
 
Posts: 4
Default

ok,

1-Unzip the com_zimbra_phone.zip
the additional code is in blue color and italic

2-In the com_zimbra_phone.xml
For the regexp english people do not have to change anythings others have to change the dial plan regexp pattern (refer to my post) and put their own.
Code:
<!-- french pattern <regex attrs="g">((\+)?(([\(0-9\)\.\- ]){4}([0-9\-\. ]){5,17}))</regex>-->
<regex attrs="g">(((\+\d{2}[-\. ]\d{5}[-\. ]?\d{5})|(\b(\d{1}[-. ])?(\(?\d{3}\)?[-. ])?\d{3}[-.]\d{4}\b)|(\(\d{3}\)[-\. ]?\d{7}))(( x| ext)[-#: ]?\d{1,5}){0,1})</regex>
Code:
   <menuItem label="${msg.skypeCall}" icon="Telephone" id="CALL"/>
   <menuItem label="${msg.clicCall}" icon="Telephone" id="CLICCALL"/>
</contextMenu>
3-In each property file com_zimbra_phone_xx_XX.properties
of course the value must be change in your own language
Code:
  search = Search
  addToContacts = Add To Contacts
  skypeCall = Skype Call
  clicCall = Call with my SoftPhone
4-Modify phone.js
Code:
function(itemId) {
	switch (itemId) {
		case "SEARCH":		this._searchListener(); break;
		case "ADDCONTACT":	this._contactListener(); break;
		case "CALL":		this._callListener(); break;
		case "CLICCALL":	this._clicCall(); break;
	}
};
The last two updates could be optimized of course by a simple function. I strip unwanted characters from the string for my softphone to be happy.
Code:
Com_Zimbra_Phone.getClicCallToLink =
function(phoneIn) {
	if (!phoneIn) { return ""; }
	var phone = AjxStringUtil.trim(phoneIn, true);
	var reg01 = new RegExp("[\+]","g");
	var reg02 = new RegExp("[-\(\)_\.\s]","g");
	phone = phone.replace(reg01, '00');
	phone = phone.replace(reg02, '');
	phone = phone.replace(/[\s]/g,"");
	return "sip:" + phone;
};


Com_Zimbra_Phone.getCallToLink =
function(phoneIn) {
	if (!phoneIn) { return ""; }
	var phone = AjxStringUtil.trim(phoneIn, true);
	var reg01 = new RegExp("[\+]","g");
	var reg02 = new RegExp("[-\(\)_\.\s]","g");
	phone = phone.replace(reg01, '00');
	phone = phone.replace(reg02, '');
	phone = phone.replace(/[\s]/g,"");
	return "callto:" + phone;
};
5- Re-zip
6- Deploy

7- Try it !
__________________
Pascal Berger
OS integration
DS Digital Systems
ZCS 6.01 on Ubuntu 8.04-LTS server_64
http://www.digsys.fr
Reply With Quote