Asterisk CLI: sip show peers cached?

I am using the Asterisk CLI Command sip show peers to display the current peers on my asterisk server.

There are about 50 phones in my network.

I am changing the user/extension of a phone by using a script for my phone (Thomson 2030).

Here is an example showing the options, which are being changed by my script:

sip set reg_id 1 123 //this changes the extension id
sip set reg_pwd 1 password //this changes the password for the extension
sip set tel_num 1 123 //this changes the extension number
sip set tel_name 1 John Doe //this changes the name, that shows up on the phone display

When the user/extension is already in use in another phone, my script automatically connects to that phone and changes the user/extension to a dummy account. The script grabs the IP of that phone from the sip show peers command.

When I now run the sip show peers command in my CLI, the old data is still present and the IP of my user/extension did not change.

Is this cached information or is there something wrong?

My problem is when I change the user/extension and then change it back to the original profile, the information I grab from sip show peers is not up to date and therefore I can not grab the correct IP of the phone.

Can you somehow refresh this information or is there even a better way to get the current IP of a phone?

Will sip reload maybe do the job? I don’t want to risk kicking out my users so I did not try to run it yet.

Sorry for the long explanation, I tried to make it as detailed as possible and I hope you didn’t fall asleep while reading. :smile:

Regards,
Brandon

It is bad security practice to make the registration ID be the same as the extension number. The correct approach to this sort of move and change is to change extensions.conf to change the mapping between extensions (directory numbers) and registration IDs (equipment numbers).

It is not entirely clear to me what you are doing to Asterisk, but sip show peers shows the same data as is used to actually route calls, and which should be updated on a sip reload or module reload chan_sip.

I believe that is essentially true, even if you user realtime, but you don’t say you are using that.

My suspicion is that the phones aren’t de-registering themselves under the old ID when you change their ID.

[quote=“david55”]…
It is not entirely clear to me what you are doing to Asterisk, but sip show peers shows the same data as is used to actually route calls, and which should be updated on a sip reload or module reload chan_sip.

I believe that is essentially true, even if you user realtime, but you don’t say you are using that.
…[/quote]

Thank you.

Could you please tell me what chan_sip does? I can’t seem to find any documentation for it.

chan_sip implements the SIP protocol. It’s over 20,000 lines of source code; there is no way anyone is going to tell you in detail what it does, here. The source code is available. The configuration options are documented in configs/sip.conf.sample.

Okay, I see. So is there any difference between sip reload and module reload chan_sip?
That doesn’t seem to be clear to me.
As far as I can tell, they both reload the sip configuration.

No. sip reload is just a shorthand for module reload chan_sip.

However, there are quite a few modules that can only have their configuration reloaded by module reload.

Hello, I have tried to run the module reload chan_sip and sip reload command last night, however it didn’t change anything.

There was also no confirmation like “Reload successful” or something like that. Don’t know if that’s normal. :confused:

:arrow_right: So I’m still stuck with the problem that asterisk does not notice when I change the phone profiles. I might need to contact the manufacturer, which is Thomson in this case.

Or do you have any other ideas?

UPDATE: nevermind, sip reload does work!
However, I noticed it only reloads my changed phones when I reboot them… I will need to find a workaround for this… And that’s most likely a Thomson issue and not an Asterisk issue.

I’m still not clear what you are actually doing. “Phone profiles” is not an Asterisk concept and Asterisk will only remove a registered address for a phone if the phone asks it to, or the registration times out.

The module reload suggestions assumed that you were explicitly changing the contents of sip.conf. If you are not doing that, module reload on chan_sip will do mothing.

As I said, you should treat the phones as devices, not as things with extension numbers, and change the extension to device mapping in Asterisk.

[quote=“david55”]I’m still not clear what you are actually doing. “Phone profiles” is not an Asterisk concept and Asterisk will only remove a registered address for a phone if the phone asks it to, or the registration times out.
[/quote]

Let me explain it to you:

I can setup 4 different profiles in my Thomson 2030 phones. Each of them has their own settings, which include the extension, password and name.

Every phone is using profile 1 by default.

By opening a telnet connection to the phone I’m able to run commands to change these profiles.

Profile 2 is using another asterisk extension than profile 1.
The settings for each profile are written down in the phone configuration.
This looks like:
[i]
regid1=100
TEL1Number=100
regpwd1=pass
DisplayName1=John Doe

regid2=101
TEL2Number=101
regpwd2=pass
DisplayName2=Bruce Wayne

regid3=102
TEL3Number=102
regpwd3=pass
DisplayName3=Peter Griffin

regid4=103
TEL4Number=103
regpwd4=pass
DisplayName4=Bill Gates
[/i]
[size=70]These settings can also be changed via commands, but lets not talk about that.[/size]

All I need is some kind of “reconnect” for the phone after the profile has been changed so asterisk will recognize the profile change… (Without rebooting the phone, as this is too time consuming!)

The regid’s are not Asterisk extensions, they are Asterisk SIP device names. It is bad security practice to make them the same as extensions.

It appears that you are not changing anything in Asterisk, so Asterisk will retain the same address for those SIP device names until the device successfully de-registers, or the registration expires. That is normal operation of SIP registration, not some special caching.

You should take a SIP trace when you reconfigure the phone. If it doesn’t de-register its old regid, that you will have to take up with the phone supplier. If it does appear to be de-registering, provide the trace here, so people can see if the request is valid.

Again, I would point out that reconfiguring the phones is the wrong way of doing this with Asterisk. They key to the right way is understanding that redid’s are not extension numbers.

Note. I believe there is an Asterisk CLI command to force the dergistration of a device, but there is no way of forcing the device to reregister immediatly after that.

Where can I find more information about device mapping in Asterisk?

core show application dial

exten => 1234,1,Dial(SIP/ffff)

maps extension 1234 to SIP device ffff

[quote=“david55”]core show application dial

exten => 1234,1,Dial(SIP/ffff)

maps extension 1234 to SIP device ffff[/quote]

Well, how do I add / manage device ffff then? I will need to configure it somehow. :confused:

EDIT: Sorry, this is not what I am looking for.

I suppose there is no Thomson 2030 SIP Phone expert here?

I found out everything works fine when I reconfigure the phone using its WEB GUI and also using the menu buttons to access the built in menu. This is NOT an asterisk problem.

The telnet functionality of my phone is driving me crazy!

Phone commands, that I run:

sip set tel_name 1 John Doe
sip set tel_num 1 714
sip set reg_id 1 714
sip set reg_pwd 1 password
sip register
commit
activate

(These are for the Thomson 2030)!

I tried contacting thomson / technicolor, but they don’t reply…

If there is anyone, who has experience with the Thomson 2030 telnet functionality, please contact me. I’m clueless.

Hello

I encounter the same problem, how have you solved

thank you