asterisk2billing.org
http://forum.asterisk2billing.org/

single username, password for web and sip/iax accounts
http://forum.asterisk2billing.org/viewtopic.php?f=35&t=7317
Page 1 of 1

Author:  thameema [ Wed Mar 17, 2010 6:06 pm ]
Post subject:  single username, password for web and sip/iax accounts

Is there a way to make single username and password (secret) to login to web, sip and iax registration. Its hard to remember multiple login and passwords. Does anyone achieved this??

Author:  thameema [ Thu Mar 18, 2010 10:41 pm ]
Post subject:  Re: single username, password for web and sip/iax accounts -SOLN

Since no one replied.. i found out my own solution. I wrote 3 triggers to update the cc_sip_buddies table and enabled the realtime.

Trigger 1:
Code:
DELIMITER $$

USE `asterisk_a2b`$$

DROP TRIGGER /*!50032 IF EXISTS */ `trigg_insert_sip_credentials`$$

CREATE
    /*!50017 DEFINER = 'root'@'localhost' */
    TRIGGER `trigg_insert_sip_credentials` AFTER INSERT ON `cc_card`
    FOR EACH ROW BEGIN
   SELECT uipass INTO @uip FROM cc_card WHERE id = new.id;
    SELECT useralias INTO @ualias FROM cc_card WHERE id = new.id;
    SET @id = new.id;
    UPDATE cc_sip_buddies SET NAME=@ualias, regexten=@ualias, secret=@uip, username=@ualias WHERE id_cc_card = @id;   
    END;
$$

DELIMITER ;


Trigger 2:
Code:
DELIMITER $$

USE `asterisk_a2b`$$

DROP TRIGGER /*!50032 IF EXISTS */ `trigg_upd_sip_credentials`$$

CREATE
    /*!50017 DEFINER = 'root'@'localhost' */
    TRIGGER `trigg_upd_sip_credentials` AFTER UPDATE ON `cc_card`
    FOR EACH ROW BEGIN   
    SELECT uipass INTO @uip FROM cc_card WHERE id = new.id;
    SELECT useralias INTO @ualias FROM cc_card WHERE id = new.id;
    SET @id = new.id;
    UPDATE cc_sip_buddies SET NAME=@ualias, regexten=@ualias, secret=@uip, username=@ualias WHERE id_cc_card = @id;   
END;
$$

DELIMITER ;


Trigger 3:
Code:
DELIMITER $$

USE `asterisk_a2b`$$

DROP TRIGGER /*!50032 IF EXISTS */ `trigg_insert_sip_cred_2`$$

CREATE
    /*!50017 DEFINER = 'root'@'localhost' */
    TRIGGER `trigg_insert_sip_cred_2` BEFORE INSERT ON `cc_sip_buddies`
    FOR EACH ROW BEGIN
    SET @id = new.id_cc_card;
    SELECT uipass INTO @uip FROM cc_card WHERE id = @id;
    SELECT useralias INTO @ualias FROM cc_card WHERE id = @id;   
    SET NEW.name=@ualias;
    SET NEW.username=@ualias;
    SET NEW.secret=@uip;
    SET NEW.regexten=@ualias;
    END;
$$

DELIMITER ;


To link the SIP/IAX to the card, I enabled the linking from "Account Code" instead of Username. Here is the modification to the code,

Code:
In file, /admin/Public/form_data/FG_var_friend.inc (change the line 63 of 986)

$HD_Form -> AddViewElement(gettext("ACCOUNTCODE"), "accountcode", "12%", "center", "sort","", "30", "", "", "", "","linktocustomer");



MODERATORS: Please move this post from "Request" to "General" Section. I am sure lot of people may need this functionality as other billing systems do this.

Thanks
Thameem

Author:  asiby [ Sun Mar 21, 2010 10:43 pm ]
Post subject:  Re: single username, password for web and sip/iax accounts

Hello Thameem

Your code seems to work, but I think that you have different credentials for security reasons. And I am not entirely sure if sip and iax username and passwords can be used to log in on the customer interface. It is that card web username or e-mail and password that are used for that.

Cheers

Author:  sanjap [ Wed Dec 26, 2012 6:09 am ]
Post subject:  Re: single username, password for web and sip/iax accounts

So the only reason we have different username password for customer UI sign in and for sip login is for security? I think there is a saying that, a chain is only as strong as it's weakest link. If one of both is weak, a hacker will get access to the stronger anyways.

Is my analogy correct?

Author:  flatpack [ Wed Jul 24, 2013 3:14 pm ]
Post subject:  Re: single username, password for web and sip/iax accounts

sanjap, i agree with you, and thanks for sharing your finding with forum.

sanjap wrote:
So the only reason we have different username password for customer UI sign in and for sip login is for security? I think there is a saying that, a chain is only as strong as it's weakest link. If one of both is weak, a hacker will get access to the stronger anyways.

Is my analogy correct?

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/