Dismiss Notice
We would like to remind you that we’re updating our login process for all 3CX forums whereby you will be able to login with the same credentials you use for the Partner or Customer Portal. Click here to read more.

ext

Discussion in 'Windows' started by pat71, Mar 18, 2016.

Thread Status:
Not open for further replies.
  1. pat71

    Joined:
    Mar 17, 2016
    Messages:
    44
    Likes Received:
    0
    Hi,
    is there way to change presence using API, or even the status of the extension.
    any one did this please.
     
  2. pj3cx

    pj3cx Active Member

    Joined:
    Aug 1, 2013
    Messages:
    646
    Likes Received:
    1
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. pat71

    Joined:
    Mar 17, 2016
    Messages:
    44
    Likes Received:
    0
    Re: Changing extension to busy using API

    Hi,
    Thank you for the reply,

    I am trying to do that, but it just do not work. can you please give me sample code to make extension busy or not ring using code c#.

    Your help is much appreciate.
     
  4. pj3cx

    pj3cx Active Member

    Joined:
    Aug 1, 2013
    Messages:
    646
    Likes Received:
    1
    Re: Changing extension to busy using API

    Hi there,
    Here's a c# sample I had ready which changes the current profile of an extension, thus the forwarding rules of the new profile will apply when dialing ext.

    Code:
    	//retrieve profiles list of ext
    	FwdProfile[] fps = ex.FwdProfiles;
    	// Available, Custom 1, CustomHours, Exceptions, Custom 2, Away, Out of office (random order)
    
    	//change profile
    	if (fps.Length > 0)
    	{
    		string newprofile = "";
    		switch (changeto)
    		{
    			case "avail": newprofile = "Available"; break;
    			case "away": newprofile = "Away"; break;
    			case "oof": newprofile = "Out of office"; break;
    			case "custom1": newprofile = "Custom 1"; break;
    			case "custom2": newprofile = "Custom 2"; break;
    		}
    
    		if (newprofile.Length > 0)
    			for (int i = 0; i < fps.Length; i++)
    			{
    				if (fps[i].Name == newprofile)
    				{
    					ex.CurrentProfile = fps[i];
    					ex.Save();
    
    					//reload to display last state
    					ex = ps.GetDNByNumber(extension.ToString()) as Extension;
    					break;
    				}
    			}
    	}
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. pat71

    Joined:
    Mar 17, 2016
    Messages:
    44
    Likes Received:
    0
    Re: Changing extension to busy using API

    Thank you,
    I just need to understand this line please.

    ex = ps.GetDNByNumber(extension.ToString()) as Extension;
    break;
    why are we using ex = , can you explain.

    many thanks
     
  6. pat71

    Joined:
    Mar 17, 2016
    Messages:
    44
    Likes Received:
    0
    Re: Changing extension to busy using API


    Thanks it work like charm.
     
  7. pat71

    Joined:
    Mar 17, 2016
    Messages:
    44
    Likes Received:
    0
    Hi,
    One more question?

    Can we change the status from Custom 1 to any message we like.
     
  8. NickD_3CX

    NickD_3CX Support Team
    Staff Member 3CX Support

    Joined:
    Jun 2, 2014
    Messages:
    1,380
    Likes Received:
    84
    The name of the Custom 1 and 2 Profiles can actually be changed from within the Management Console -> Settings -> PBX (V14).
     
  9. pat71

    Joined:
    Mar 17, 2016
    Messages:
    44
    Likes Received:
    0
    Thanks.
     
Thread Status:
Not open for further replies.