Strange thing about sms in linphone

Is a linphone bug, or there is a solution?

This is my sms extensions.conf


exten => telefono1,1,NoOp(SMS receiving dialplan invoked)
same => n,NoOp(To ${MESSAGE(to)})
same => n,NoOp(From ${MESSAGE(from)})
same => n,NoOp(Body ${MESSAGE(body)})
same => n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
same => n,ExecIf($["${ACTUALTO}" = "pjsip:telefono1"]?set(ACTUALTO2=telefono1))
same => n,ExecIf($["${ACTUALTO}" = "pjsip:telefono2"]?set(ACTUALTO2=telefono2))
same => n,MessageSend(pjsip:${ACTUALTO2},"${CALLERID(name)}"${MESSAGE(from)})
same => n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
same => n,GotoIf($["${MESSAGE_SEND_STATUS}" != "SUCCESS"]?sendfailedmsg)
same => n,Hangup()
same => n(sendfailedmsg),Set(MESSAGE(body)="[${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}] Your message to ${EXTEN} has failed. Retry later.")
same => n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
same => n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
same => n,MessageSend(${ACTUALFROM},ServiceCenter)
same => n,Hangup()

exten => telefono2,1,NoOp(SMS receiving dialplan invoked)
same => n,NoOp(To ${MESSAGE(to)})
same => n,NoOp(From ${MESSAGE(from)})
same => n,NoOp(Body ${MESSAGE(body)})
same => n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
same => n,ExecIf($["${ACTUALTO}" = "pjsip:telefono1"]?set(ACTUALTO2=telefono1))
same => n,ExecIf($["${ACTUALTO}" = "pjsip:telefono2"]?set(ACTUALTO2=telefono2))
same => n,MessageSend(pjsip:${ACTUALTO2},"${CALLERID(name)}"${MESSAGE(from)})
same => n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
same => n,GotoIf($["${MESSAGE_SEND_STATUS}" != "SUCCESS"]?sendfailedmsg)
same => n,Hangup()
same => n(sendfailedmsg),Set(MESSAGE(body)="[${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}] Your message to ${EXTEN} has failed. Retry later.")
same => n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
same => n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
same => n,MessageSend(${ACTUALFROM},ServiceCenter)
same => n,Hangup()

The messages works fine: i can send and receive from linphone to sip phone grandstream

Only one problem:

the messages arrive to linphone with address “sip:telefono1@mydomain” instead of correct “sip:1000@mydomain”. So I can receive, but I cannot reply because the sip address is not valid (i can use the workaround to rename contact from telefono1 to 1000). There is a way to fix this?
Console report

“To address ‘telefono1@asterisk1.mydomain.priv’ is not a valid SIP/SIPS URI”

The strange situation, as you can see linphone add two contacts. One has the incorrect address sip://telefono1@asterisk1.mydomain.priv, the other one has correct address, if I remove the first contact, when I receive the sms is re-created.