How to confirm slot after it was settled and reset it by user's choice

I am trying to set slot and then ask a user if a slot correct or not if slot is not correct I want to reset it promt to specify phone nimbe once agan

I have read this post FormAction: redo slot after asking for confirmation but still have some problems my domain file

intents:
  - user_confirm
  - user_no
  - user.don't_get_sms
  - greet
  - mobile_number:
      use_entities:
        - phone-number

entities:
  - phone-number

slots:
  phone-number:
    type: text
    initial_value: null

responses:
  utter_greet:
  - text: "Hi"

  utter_ask_phone-number:
  - text: Пожалуйста укажите номер Вашего телефона?


  utter_details_thanks:
    - text: "thx, we will check your number {Mobile_number}"

  utter_mobile_number_entered:
    - text: "greate"

  utter_confirm_phone_number:
    - text: "Your phone number {phone-number}. Is it correct?"  

  utter_phone-number_not_valid:
    - text: "You entered the phone number in an incorrect format, please enter it together (example: +79111231212) "

  utter_ask_reenter_phone_number:
    - text: "please try to enter the number again "

  utter_sad:
    - text: "it's a pity"

  utter_try_again:
    - text: "try again "

actions:
  - action_check_user's_sms
  - validate_get_users_phone_form
  - action_phone_number_not_confirmed

forms:
  get_users_phone_form:
    required_slots:    
      phone-number:
        - type: from_entity
          entity: phone-number

stories

- story: user sad his phone number and confirm it
  steps:
  - intent: mobile_number
  - action: get_users_phone_form
  - active_loop: get_users_phone_form
  - active_loop: null
  - slot_was_set:
    - requested_slot: null 
  - action: utter_confirm_phone_number
  - intent: user_confirm
  - action: utter_mobile_number_entered

- story: user sad his phone number BUT it was wrong and he DIDN'T confirm it
  steps:
  - intent: mobile_number
  - action: get_users_phone_form
  - active_loop: get_users_phone_form
  - active_loop: null
  - slot_was_set:
    - requested_slot: null 
  - action: utter_confirm_phone_number
  - intent: user_no
  - action: action_phone_number_not_confirmed
  - action: utter_sad
  - action: utter_try_again

actions

class ActionCheckSmsInSmsCenter(Action):
    def name(self) -> Text:
        return "action_check_user's_sms"

    def run(
        self,
        dispatcher,
        tracker: Tracker,
        domain: "DomainDict",
    ) -> List[Dict[Text, Any]]:
        dispatcher.utter_message(response="utter_details_thanks",
                                 Mobile_number=tracker.get_slot("phone-number"))

class ActionPhoneNumberNotConfirmed(Action):
    def name(self) -> Text:
        return "action_phone_number_not_confirmed"

    def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, 
                domain: Dict[Text, Any]) -> List[EventType]:
        print("______________ will reset slot __________________")
        return [SlotSet("phone-number", None)]

class ValidateGetUsersPhoneForm(FormValidationAction):
    def name(self) -> Text:
        return "validate_get_users_phone_form"

    def validate_phone_number(
        self,
        slot_value: Text,
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: DomainDict,
    ) -> Dict[Text, Any]:
        """Validate phone_number value."""

        if isinstance(slot_value, str):
            SYMBOLS = '{}()[]+-* '
            print(f"phone number slot value before check = {slot_value}")
            slot_value = slot_value.translate(slot_value.maketrans('','',SYMBOLS)).strip()
            if (len(slot_value) > 9 and len(slot_value) < 14): 
                return {"phone-number": slot_value}
            else:
                dispatcher.utter_message(response="utter_phone-number_not_valid")
                return {"phone-number": None}

        else:
            dispatcher.utter_message(response="utter_phone-number_not_valid")
            return {"phone-number": None}

rules

- rule: activatie form for number obrain
  steps:
  - intent: mobile_number
  - action: get_users_phone_form
  - active_loop: get_users_phone_form

nlu

- intent: mobile_number
  examples: |
    - my phone number is 8209829808
    - cellphone number 8209829808
    - number of my cellphone is 8209829808
    - my phone number is 8209829808
    - my phone number is 8 209 829 80 8
    - my phone number is +7 (903) 580-00-00
    - my phone number is 8 903 580 00 00
    - my phone number is +8209829808
    - my phone number is 79012109874
    - my phone number is 7916 300 00-20
    - my phone number is 7-916-000 00-20
    - my phone number is 7 916 000 00 20    
    - my phone number is se9829808
    - phone number is ы8209в08
    - my cellphone number is 8209829808


- intent: user.don't_get_sms
  examples: |
    - я не получаю сообщения на свой мобильный телефон 8209829808
    - не приходят смс
    - мне не доставляются sms сообщения
    - не получаю смски
    - не получаю смс-ки на свой телефон 8209829808
    - не доходят сообщения на телефон 8209829808
    - не могу получить код на свой телефон 8209829808
    - не получаю код подтверждения на телефон 8209829808    

- intent: user_confirm
  examples: |
    - yes
    - sure
    - ок
#e.t.c.

- intent: user_no
  examples: |
    - no
    - not
#e.t.c.

I extract phone number with a DucklingEntityExtractor

as a result a get a slot value and ask a user is it correct or not. user sad that a phone number is not correct and i am trying to reset it, but there no luck here my log of rasa shell --debug comandshell-debug.log (19.3 KB)

Hi, based on the logs it looks like the phone number is being re-set:

2021-09-20 17:43:09 DEBUG    rasa.core.processor  - Action 'action_phone_number_not_confirmed' ended with events '[<rasa.shared.core.events.SlotSet object at 0x7fd4912e6978>]'.
2021-09-20 17:43:09 DEBUG    rasa.core.processor  - Current slot values:
        phone-number: None
        requested_slot: None
        session_started_metadata: None

You should probably have a rule that specifies what should happen, and re-starts the form:

- rule: re-ask phone number
  steps:
  - action: utter_confirm_phone_number
  - intent: user_no
  - action: action_phone_number_not_confirmed
  - active_loop: get_users_phone_form

@fkoerner yes, i saw it, but i don’t understand how(and why) it was setted once again and i don’t want to re-starts the form i just want to say something like “sorry but… bla bla bla”

@nik202 can you help me with this proble? i will be appreciated for your help

i just want to say something like “sorry but… bla bla bla”

Do you have a rule for this behaviour? Or in your custom action?

@fkoerner I have such story. am i wrong? should i have another rule?